|
10 | 10 | import java.util.*; |
11 | 11 |
|
12 | 12 | public class ASAPEncounterManagerImpl implements ASAPEncounterManager, |
13 | | - EncounterManagerAdmin, |
| 13 | + ASAPEncounterManagerAdmin, |
14 | 14 | ASAPConnectionListener { |
15 | 15 | public static final long DEFAULT_WAIT_BEFORE_RECONNECT_TIME = 1000; // a second - debugging |
16 | 16 | public static final long DEFAULT_WAIT_TO_AVOID_RACE_CONDITION = 500; // milliseconds - worked fine with BT. |
17 | 17 |
|
18 | | - private final int randomValue; |
19 | | - private final long waitBeforeReconnect; |
| 18 | + private int randomValue; |
| 19 | + private long waitBeforeReconnect; |
20 | 20 | private ASAPConnectionHandler asapConnectionHandler; // object that will eventually run the ASAP session |
21 | 21 |
|
22 | 22 | /* |
@@ -52,7 +52,7 @@ public ASAPEncounterManagerImpl(ASAPConnectionHandler asapConnectionHandler, lon |
52 | 52 | this.restoreDenyList(); |
53 | 53 | } |
54 | 54 |
|
55 | | - private boolean coolDownOver(CharSequence id, EncounterConnectionType connectionType) { |
| 55 | + private boolean coolDownOver(CharSequence id, ASAPEncounterConnectionType connectionType) { |
56 | 56 | Date now = new Date(); |
57 | 57 | Date lastEncounter = this.encounterDate.get(id); |
58 | 58 |
|
@@ -87,7 +87,7 @@ private boolean coolDownOver(CharSequence id, EncounterConnectionType connection |
87 | 87 | } |
88 | 88 |
|
89 | 89 | @Override |
90 | | - public boolean shouldCreateConnectionToPeer(CharSequence remoteAdressOrPeerID, EncounterConnectionType connectionType) { |
| 90 | + public boolean shouldCreateConnectionToPeer(CharSequence remoteAdressOrPeerID, ASAPEncounterConnectionType connectionType) { |
91 | 91 | // do we have a connection under a peerID? |
92 | 92 | StreamPair streamPair = this.openStreamPairs.get(remoteAdressOrPeerID); |
93 | 93 | if(streamPair != null) { |
@@ -118,19 +118,19 @@ public boolean shouldCreateConnectionToPeer(CharSequence remoteAdressOrPeerID, E |
118 | 118 | } |
119 | 119 |
|
120 | 120 | @Override |
121 | | - public void handleEncounter(StreamPair streamPair, EncounterConnectionType connectionType) throws IOException { |
| 121 | + public void handleEncounter(StreamPair streamPair, ASAPEncounterConnectionType connectionType) throws IOException { |
122 | 122 | this.handleEncounter(streamPair, connectionType, false, false); |
123 | 123 | } |
124 | 124 |
|
125 | 125 | @Override |
126 | | - public void handleEncounter(StreamPair streamPair, EncounterConnectionType connectionType, boolean initiator) |
| 126 | + public void handleEncounter(StreamPair streamPair, ASAPEncounterConnectionType connectionType, boolean initiator) |
127 | 127 | throws IOException { |
128 | 128 |
|
129 | 129 | this.handleEncounter(streamPair, connectionType, initiator, true); |
130 | 130 | } |
131 | 131 |
|
132 | | - private void handleEncounter(StreamPair streamPair, EncounterConnectionType connectionType, boolean initiator, |
133 | | - boolean raceCondition) throws IOException { |
| 132 | + private void handleEncounter(StreamPair streamPair, ASAPEncounterConnectionType connectionType, boolean initiator, |
| 133 | + boolean raceCondition) throws IOException { |
134 | 134 |
|
135 | 135 | CharSequence streamPairID = streamPair.getSessionID(); |
136 | 136 |
|
@@ -300,12 +300,12 @@ public synchronized void asapConnectionTerminated(Exception terminatingException |
300 | 300 | // EncounterManagerAdmin // |
301 | 301 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
302 | 302 |
|
303 | | - private Set<CharSequence> denyList; |
| 303 | + private Set<CharSequence> denyList = new HashSet<>(); |
304 | 304 |
|
305 | 305 | //// housekeeping |
306 | 306 | private void restoreDenyList() { |
307 | 307 | // TODO |
308 | | - this.denyList = new HashSet<>(); |
| 308 | + //this.denyList = new HashSet<>(); |
309 | 309 | Log.writeLog(this, "need to implement restoreDenyList"); |
310 | 310 | } |
311 | 311 |
|
|
0 commit comments