Skip to content

Commit cfcc1ef

Browse files
committed
log messages slightly changed
1 parent 2b17696 commit cfcc1ef

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

src/main/java/net/sharksystem/asap/ASAPEncounterManagerAdmin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public interface ASAPEncounterManagerAdmin {
5858
* Cancel a connection to a peer. This method call does not change the deny list.
5959
* @param peerID
6060
*/
61-
void cancelConnection(CharSequence peerID);
61+
void closeEncounter(CharSequence peerID);
6262

6363

6464
/**

src/main/java/net/sharksystem/asap/ASAPEncounterManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ private boolean solveRaceCondition(StreamPair streamPair, boolean connectionInit
324324
@Override
325325
public synchronized void asapConnectionStarted(String remotePeerName, ASAPConnection connection) {
326326
CharSequence peerID = connection.getEncounteredPeer();
327-
Log.writeLog(this, this.toString(), "new ASAP session: " + connection);
327+
Log.writeLog(this, this.toString(), "new ASAP encounter: " + connection);
328328

329329
CharSequence streamPairID = this.openASAPConnections.get(connection);
330330
if(PeerIDHelper.sameID(streamPairID, peerID)) {
@@ -345,7 +345,7 @@ public synchronized void asapConnectionStarted(String remotePeerName, ASAPConnec
345345

346346
@Override
347347
public synchronized void asapConnectionTerminated(Exception terminatingException, ASAPConnection connection) {
348-
Log.writeLog(this, this.toString(), "terminated: " + connection);
348+
Log.writeLog(this, this.toString(), "encounter terminated: " + connection);
349349
CharSequence peerID = connection.getEncounteredPeer();
350350

351351
CharSequence peerIDOrAddress = this.openASAPConnections.get(connection);
@@ -456,7 +456,7 @@ public ASAPEncounterConnectionType getConnectionType(CharSequence peerID) throws
456456
}
457457

458458
@Override
459-
public void cancelConnection(CharSequence peerID) {
459+
public void closeEncounter(CharSequence peerID) {
460460
StreamPair stream2Close = this.openStreamPairs.get(peerID);
461461
if(stream2Close != null) {
462462
stream2Close.close();

src/main/java/net/sharksystem/asap/engine/ASAPInternalPeerFS.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ public Set<CharSequence> getOnlinePeers() {
461461
}
462462

463463
@Override
464-
public void asapConnectionStarted(String remotePeerName, ASAPConnection thread) {
465-
if(thread == null) {
464+
public void asapConnectionStarted(String remotePeerName, ASAPConnection asapConnection) {
465+
if(asapConnection == null) {
466466
StringBuilder sb = new StringBuilder();
467467
sb.append(this.getLogStart());
468-
sb.append("asap connection started but thread terminated cannot be null - do nothing");
468+
sb.append("asap connection started but asapConnection terminated cannot be null - do nothing");
469469
Log.writeLogErr(this,sb.toString());
470470
return;
471471
}
@@ -484,28 +484,28 @@ public void asapConnectionStarted(String remotePeerName, ASAPConnection thread)
484484
sb.append(remotePeerName);
485485
Log.writeLog(this, sb.toString());
486486

487-
this.connectedThreads.put(remotePeerName, thread);
488-
this.threadPeerNames.put(thread, remotePeerName);
487+
this.connectedThreads.put(remotePeerName, asapConnection);
488+
this.threadPeerNames.put(asapConnection, remotePeerName);
489489
this.notifyOnlinePeersChangedListener();
490490
}
491491

492492
@Override
493-
public synchronized void asapConnectionTerminated(Exception terminatingException, ASAPConnection thread) {
494-
if(thread == null) {
493+
public synchronized void asapConnectionTerminated(Exception terminatingException, ASAPConnection asapConnection) {
494+
if(asapConnection == null) {
495495
StringBuilder sb = new StringBuilder();
496496
sb.append(this.getLogStart());
497497
sb.append("terminated connection cannot be null - do nothing");
498498
Log.writeLogErr(this, sb.toString());
499499
return;
500500
}
501501

502-
// get thread name
503-
CharSequence peerName = this.threadPeerNames.remove(thread);
502+
// get asapConnection name
503+
CharSequence peerName = this.threadPeerNames.remove(asapConnection);
504504
this.connectedThreads.remove(peerName);
505505

506506
StringBuilder sb = new StringBuilder();
507507
sb.append(this.getLogStart());
508-
sb.append("thread terminated connected to: ");
508+
sb.append("asapConnection terminated connected to: ");
509509

510510
if(peerName != null) {
511511
sb.append(peerName);

src/main/java/net/sharksystem/asap/protocol/ASAPSessionImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void kill() {
111111
public void kill(Exception e) {
112112
if(!this.terminated) {
113113
this.terminated = true;
114-
// kill reader - proofed to be useful in a bluetooth environment
114+
// kill reader - proved to be useful in a bluetooth environment
115115
if(this.pduReader != null && this.pduReader.isAlive()) {
116116
this.pduReader.interrupt();
117117
}
@@ -312,6 +312,8 @@ public void run() {
312312
}
313313
}
314314
}
315+
316+
// asap session ended
315317
}
316318

317319
private Thread threadUsingStreams = null;

src/test/java/junit5Tests/release_1/net/sharksystem/asap/LSANEncounterManagerAdminTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void testAliceSendsOneMessageConnectionKilled() throws InterruptedExcepti
120120
this.runAliceBobEncounter();
121121

122122
// kill connection via encounter manager
123-
aliceEncounterManager.cancelConnection(TestConstants.BOB_ID);
123+
aliceEncounterManager.closeEncounter(TestConstants.BOB_ID);
124124
// try to send another message
125125
aliceASAPPeerFS.sendASAPMessage(TestConstants.TEST_APP_FORMAT, TestConstants.URI, TestConstants.MESSAGE_2);
126126
Thread.sleep(200);

0 commit comments

Comments
 (0)