diff --git a/Implementation/src/RunnerTCPEcoute.class b/Implementation/src/RunnerTCPEcoute.class index dfc1313..a029f97 100644 Binary files a/Implementation/src/RunnerTCPEcoute.class and b/Implementation/src/RunnerTCPEcoute.class differ diff --git a/Implementation/src/RunnerTCPEnvoi.class b/Implementation/src/RunnerTCPEnvoi.class index 0065535..a2267ef 100644 Binary files a/Implementation/src/RunnerTCPEnvoi.class and b/Implementation/src/RunnerTCPEnvoi.class differ diff --git a/Implementation/src/TCPEchange.class b/Implementation/src/TCPEchange.class index c5f4e52..755f7d9 100644 Binary files a/Implementation/src/TCPEchange.class and b/Implementation/src/TCPEchange.class differ diff --git a/Implementation/src/TCPEchange.java b/Implementation/src/TCPEchange.java index f8404ee..63b3c23 100644 --- a/Implementation/src/TCPEchange.java +++ b/Implementation/src/TCPEchange.java @@ -36,7 +36,7 @@ public class TCPEchange { }catch(InterruptedException e) { System.out.println("Un thread s'est arrete brusquement"); } - System.out.println("Tout s'est passé crème"); + System.out.println("Tout s'est passe creme"); app.getHist(User2.getPseudo()).afficher10derniers(); } @@ -126,23 +126,27 @@ class RunnerTCPEnvoi implements Runnable { } MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1); if(msg.equals("--STOP--")) { - mh = new MessageHorodate(Destinataire,app.getMe(),msg,0); + mh = new MessageHorodate(Destinataire,app.getMe(),msg,0); // ENVOYER JUSTE --STOP-- SUFFIT out.println(mh); out.flush(); break; } - while(!app.isHistoriqueAvailable()) { + /* while(!app.isHistoriqueAvailable()) { try{wait(); }catch(InterruptedException e) {} - } - app.setHistoriqueAvailable(false); - Historique h = app.getHist(Destinataire.getPseudo()); - h.addMessage(mh); + }*/ + //app.setHistoriqueAvailable(false); + synchronized( this.app.getMapHistorique()) { + Historique h = app.getHist(Destinataire.getPseudo()); + h.addMessage(mh); + app.majHistorique(h); + } + // on update la liste des historiques de app - app.majHistorique(h); + //app.majHistorique2(mh.toString(),Destinataire.getPseudo()); - app.setHistoriqueAvailable(false); - notifyAll(); + //app.setHistoriqueAvailable(false); + //notifyAll(); out.println(mh); System.out.println("Envoi d'un mesage"); out.flush(); @@ -201,17 +205,17 @@ class RunnerTCPEcoute implements Runnable { MessageHorodate mh = MessageHorodate.stringToMessageHorodate(msg); System.out.println("Type du message:"+mh.getType()); if(mh.getType()==1) { - while(!app.isHistoriqueAvailable()) { + /*while(!app.isHistoriqueAvailable()) { try{wait(); }catch(InterruptedException e) {} } - app.setHistoriqueAvailable(false); + app.setHistoriqueAvailable(false);*/ System.out.println("Historique mis à jour lors de la reception"); Historique h = app.getHist(mh.getSource().getPseudo()); h.addMessage(mh); app.majHistorique(h); - app.setHistoriqueAvailable(true); - notifyAll(); + //app.setHistoriqueAvailable(true); + //notifyAll(); //app.majHistorique2(mh,mh.getSource().getPseudo()); } else if(mh.getType()==0) {