Skip to content

Commit 6fe24f0

Browse files
committed
integration into SharkNetMessenger
1 parent e3eacd6 commit 6fe24f0

11 files changed

Lines changed: 25 additions & 266 deletions

File tree

Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

Dockerfile.HubCLI

Lines changed: 0 additions & 14 deletions
This file was deleted.

Dockerfile.HubTester

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

libs/ASAPJava.jar

4.69 KB
Binary file not shown.

makeASAPHubJar.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cd target/classes/
2+
jar -cvf ASAPHub.jar net
3+
mv ASAPHub.jar ../../ASAPHub.jar
4+
cd ../../

pom.xml

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/main/java/net/sharksystem/hub/BasicHubConnectionManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public abstract class BasicHubConnectionManager implements HubConnectionManager
2626

2727
private long lastSync = System.currentTimeMillis();
2828

29+
public long getLastSyncTime() {
30+
return this.lastSync;
31+
}
32+
2933
/**
3034
* Hub manager can be asked to connect to or disconnect from hubs. We send a list of hubs which are to be
3135
* connected. Connection establishment can take a while, though. It is a wish list on application side for a while.
@@ -36,9 +40,9 @@ public abstract class BasicHubConnectionManager implements HubConnectionManager
3640
* accurate. We can keep track of failed attempts. And we do.
3741
*/
3842
protected void syncLists() {
39-
// avoid calls within milliseconds
43+
// wait at least a second for a new sync
4044
long now = System.currentTimeMillis();
41-
if (now - this.lastSync <= 100) return;
45+
if (now - this.lastSync <= MINIMAL_TIME_BEFORE_NEXT_HUB_SYNC_IN_MILLIS) return;
4246
this.lastSync = now;
4347

4448
// ask for current list from hub

src/main/java/net/sharksystem/hub/HubConnectionManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
* Interface for applications. It allows connection management with hubs.
1212
*/
1313
public interface HubConnectionManager extends NewHubConnectionListenerManagement {
14+
/**
15+
* The minimum time between two sync attempts between peer and hub.
16+
* Around a second sounds like a reasonable time.
17+
*/
18+
int MINIMAL_TIME_BEFORE_NEXT_HUB_SYNC_IN_MILLIS = 1000;
19+
20+
/**
21+
*
22+
* @return time when last sync with hubs happened.
23+
*/
24+
long getLastSyncTime();
25+
1426
/**
1527
* Connect a hub
1628
* @param hcd Hub description

src/main/java/net/sharksystem/hub/peerside/ASAPHubManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.List;
88

99
public interface ASAPHubManager {
10-
int DEFAULT_WAIT_INTERVAL_IN_SECONDS = 600; // 10 minutes
10+
int DEFAULT_WAIT_INTERVAL_IN_SECONDS = 600; // 60 seconds * 10 = 10 minutes
1111

1212
/**
1313
* Hubs are checked frequently for new peers. Connections are established.

0 commit comments

Comments
 (0)