@@ -402,9 +402,18 @@ public void handleASAPAssimilate(ASAP_AssimilationPDU_1_0 asapAssimilationPDU, A
402402
403403 // debug break
404404 //Log.writeLog(this, "!!!!!!!!!!!!!!!!!!!!!!!! ASSIMILATE PDU senderE2E: " + senderE2E);
405+ /*
405406 if(PeerIDHelper.sameID(senderE2E, "Alice_42")) {
406407 int i = 42;
407408 }
409+ */
410+
411+ if (PeerIDHelper .sameID (senderE2E , this .owner )) {
412+ Log .writeLogErr (this , "I was offered messages from myself ("
413+ + this .owner + ") by " + encounteredPeer + " - refused: " );
414+ asapAssimilationPDU .takeDataFromStream ();
415+ return ;
416+ }
408417
409418 //<<<<<<<<<<<<<<<<<<debug
410419 StringBuilder b = new StringBuilder ();
@@ -559,7 +568,8 @@ private boolean hasSufficientCrypto(ASAP_PDU_1_0 pdu) {
559568 return proceed ;
560569 }
561570
562- public void handleASAPInterest (ASAP_Interest_PDU_1_0 asapInterest , ASAP_1_0 protocol , OutputStream os )
571+ public void handleASAPInterest (ASAP_Interest_PDU_1_0 asapInterest , ASAP_1_0 protocol ,
572+ String encounteredPeer , OutputStream os , EncounterConnectionType connectionType )
563573 throws ASAPException , IOException {
564574
565575 // before we start - lets crypto: TODO can be removed - do it on communication not engine level
@@ -583,9 +593,11 @@ public void handleASAPInterest(ASAP_Interest_PDU_1_0 asapInterest, ASAP_1_0 prot
583593 /* We have got an interest from another peer.
584594 First: Let's find what chunks from our peer are be be sent to get in sync. */
585595 Map <String , Integer > encounterMap = null ;
586- Integer lastSeenEra = null ;
596+ // Integer lastSeenEra = null;
597+ Integer lastSeenEra = this .lastSeen .get (senderID );
587598
588599 // has it even provided an encounter list?
600+ /* Cannot do this - sent era is their era not ours.
589601 if(asapInterest.encounterList()) {
590602 encounterMap = asapInterest.getEncounterMap();
591603 lastSeenEra = encounterMap.get(this.getOwner());
@@ -598,6 +610,7 @@ public void handleASAPInterest(ASAP_Interest_PDU_1_0 asapInterest, ASAP_1_0 prot
598610 // no entry in encounter list - local history?
599611 lastSeenEra = this.lastSeen.get(senderID);
600612 }
613+ */
601614
602615 if (lastSeenEra == null ) {
603616 // still nothing
@@ -654,6 +667,10 @@ public void handleASAPInterest(ASAP_Interest_PDU_1_0 asapInterest, ASAP_1_0 prot
654667 // iterate: what sender do we know in our side?
655668 for (CharSequence receivedFromID : this .getSender ()) {
656669 Log .writeLog (this , "we have messages from " + receivedFromID );
670+ if (PeerIDHelper .sameID (encounteredPeer , receivedFromID )) {
671+ // do not send messages back
672+ continue ;
673+ }
657674 try {
658675 ASAPStorage receivedMessagesStorage = this .getExistingIncomingStorage (receivedFromID );
659676
0 commit comments