TCP fini Historique KO
This commit is contained in:
부모
9010fe3f23
커밋
2eb1862b9c
4개의 변경된 파일과 18개의 추가작업 그리고 14개의 파일을 삭제
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -36,7 +36,7 @@ public class TCPEchange {
|
||||||
}catch(InterruptedException e) {
|
}catch(InterruptedException e) {
|
||||||
System.out.println("Un thread s'est arrete brusquement");
|
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();
|
app.getHist(User2.getPseudo()).afficher10derniers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,23 +126,27 @@ class RunnerTCPEnvoi implements Runnable {
|
||||||
}
|
}
|
||||||
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
|
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
|
||||||
if(msg.equals("--STOP--")) {
|
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.println(mh);
|
||||||
out.flush();
|
out.flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while(!app.isHistoriqueAvailable()) {
|
/* while(!app.isHistoriqueAvailable()) {
|
||||||
try{wait();
|
try{wait();
|
||||||
}catch(InterruptedException e) {}
|
}catch(InterruptedException e) {}
|
||||||
}
|
}*/
|
||||||
app.setHistoriqueAvailable(false);
|
//app.setHistoriqueAvailable(false);
|
||||||
Historique h = app.getHist(Destinataire.getPseudo());
|
synchronized( this.app.getMapHistorique()) {
|
||||||
h.addMessage(mh);
|
Historique h = app.getHist(Destinataire.getPseudo());
|
||||||
|
h.addMessage(mh);
|
||||||
|
app.majHistorique(h);
|
||||||
|
}
|
||||||
|
|
||||||
// on update la liste des historiques de app
|
// on update la liste des historiques de app
|
||||||
app.majHistorique(h);
|
|
||||||
//app.majHistorique2(mh.toString(),Destinataire.getPseudo());
|
//app.majHistorique2(mh.toString(),Destinataire.getPseudo());
|
||||||
app.setHistoriqueAvailable(false);
|
//app.setHistoriqueAvailable(false);
|
||||||
notifyAll();
|
//notifyAll();
|
||||||
out.println(mh);
|
out.println(mh);
|
||||||
System.out.println("Envoi d'un mesage");
|
System.out.println("Envoi d'un mesage");
|
||||||
out.flush();
|
out.flush();
|
||||||
|
@ -201,17 +205,17 @@ class RunnerTCPEcoute implements Runnable {
|
||||||
MessageHorodate mh = MessageHorodate.stringToMessageHorodate(msg);
|
MessageHorodate mh = MessageHorodate.stringToMessageHorodate(msg);
|
||||||
System.out.println("Type du message:"+mh.getType());
|
System.out.println("Type du message:"+mh.getType());
|
||||||
if(mh.getType()==1) {
|
if(mh.getType()==1) {
|
||||||
while(!app.isHistoriqueAvailable()) {
|
/*while(!app.isHistoriqueAvailable()) {
|
||||||
try{wait();
|
try{wait();
|
||||||
}catch(InterruptedException e) {}
|
}catch(InterruptedException e) {}
|
||||||
}
|
}
|
||||||
app.setHistoriqueAvailable(false);
|
app.setHistoriqueAvailable(false);*/
|
||||||
System.out.println("Historique mis à jour lors de la reception");
|
System.out.println("Historique mis à jour lors de la reception");
|
||||||
Historique h = app.getHist(mh.getSource().getPseudo());
|
Historique h = app.getHist(mh.getSource().getPseudo());
|
||||||
h.addMessage(mh);
|
h.addMessage(mh);
|
||||||
app.majHistorique(h);
|
app.majHistorique(h);
|
||||||
app.setHistoriqueAvailable(true);
|
//app.setHistoriqueAvailable(true);
|
||||||
notifyAll();
|
//notifyAll();
|
||||||
//app.majHistorique2(mh,mh.getSource().getPseudo());
|
//app.majHistorique2(mh,mh.getSource().getPseudo());
|
||||||
}
|
}
|
||||||
else if(mh.getType()==0) {
|
else if(mh.getType()==0) {
|
||||||
|
|
불러오는 중…
Reference in a new issue