Skip to content

Commit 2aae589

Browse files
committed
messages in closed channels are now longer transmitted to other peers.
1 parent c81ee8c commit 2aae589

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/net/sharksystem/asap/ASAPEngine.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,26 +368,27 @@ public void handleASAPAssimilate(ASAP_AssimilationPDU_1_0 asapAssimiliationPDU,
368368
String uri = asapAssimiliationPDU.getChannelUri();
369369

370370
// get local target for data to come
371-
ASAPChunk incomingChunk = incomingSenderStorage.getChunk(uri, eraSender);
371+
ASAPChunk localChunk = null;
372372

373-
if(!incomingSenderStorage.existsChunk(uri, eraSender) && asapAssimiliationPDU.recipientPeerSet()) {
373+
if(!incomingSenderStorage.existsChunk(uri, eraSender)) {
374374
//<<<<<<<<<<<<<<<<<<debug
375375
b = new StringBuilder();
376376
b.append(this.getLogStart());
377-
b.append("recipient (");
378-
b.append(asapAssimiliationPDU.getRecipientPeer());
379-
b.append(") no incoming chunk yet:");
377+
b.append("no incoming chunk yet | ");
380378
b.append(asapAssimiliationPDU.toString());
379+
System.out.println(b.toString());
381380
//>>>>>>>>>>>>>>>>>>>debug
382381

383382
// is there a local chunk - to clone recipients from?
384383
if(this.channelExists(uri)) {
385-
b.append("local chunk exists - copy meta data");
386-
incomingChunk.copyMetaData(this.getChannel(uri));
387-
} else {
388-
b.append("no local chunk to copy meta data from");
384+
localChunk = this.getStorage().getChunk(uri, this.getEra());
389385
}
390-
System.out.println(b.toString());
386+
}
387+
388+
ASAPChunk incomingChunk = incomingSenderStorage.getChunk(uri, eraSender);
389+
if(localChunk != null) {
390+
System.out.println(this.getLogStart() + "copy local meta data into newly created incoming chunk");
391+
incomingChunk.copyMetaData(this.getChannel(uri));
391392
}
392393

393394
List<Integer> messageOffsets = asapAssimiliationPDU.getMessageOffsets();
@@ -656,6 +657,8 @@ private void sendChunks(CharSequence sender, String remotePeer, ASAPChunkStorage
656657
System.out.println(b.toString());
657658
}
658659
}
660+
} else {
661+
System.out.println(this.getLogStart() + "nothing sent: empty or not on recipient list");
659662
}
660663
}
661664

0 commit comments

Comments
 (0)