start connection manager, fix some issues
This commit is contained in:
@@ -88,6 +88,7 @@ class Core {
|
|||||||
new LeafConnectionManager(eventBus,3, hostCache) : new UltrapeerConnectionManager(eventBus, 512, 512, hostCache)
|
new LeafConnectionManager(eventBus,3, hostCache) : new UltrapeerConnectionManager(eventBus, 512, 512, hostCache)
|
||||||
eventBus.register(TrustEvent.class, connectionManager)
|
eventBus.register(TrustEvent.class, connectionManager)
|
||||||
eventBus.register(ConnectionEvent.class, connectionManager)
|
eventBus.register(ConnectionEvent.class, connectionManager)
|
||||||
|
connectionManager.start()
|
||||||
|
|
||||||
log.info("initializing cache client")
|
log.info("initializing cache client")
|
||||||
CacheClient cacheClient = new CacheClient(eventBus,hostCache, connectionManager, i2pSession, props, 10000)
|
CacheClient cacheClient = new CacheClient(eventBus,hostCache, connectionManager, i2pSession, props, 10000)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ abstract class ConnectionManager {
|
|||||||
|
|
||||||
abstract void onConnectionEvent(ConnectionEvent e)
|
abstract void onConnectionEvent(ConnectionEvent e)
|
||||||
|
|
||||||
private void sendPings() {
|
protected void sendPings() {
|
||||||
final long now = System.currentTimeMillis()
|
final long now = System.currentTimeMillis()
|
||||||
getConnections().each {
|
getConnections().each {
|
||||||
if (now - it.lastPingSentTime > PING_TIME)
|
if (now - it.lastPingSentTime > PING_TIME)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class PeerConnection extends Connection {
|
|||||||
byte [] payload
|
byte [] payload
|
||||||
if (message instanceof Map) {
|
if (message instanceof Map) {
|
||||||
payload = JsonOutput.toJson(message)
|
payload = JsonOutput.toJson(message)
|
||||||
DataUtil.packHeader(payload.bytes.length, writeHeader)
|
DataUtil.packHeader(payload.length, writeHeader)
|
||||||
writeHeader[0] &= 0x7F
|
writeHeader[0] &= 0x7F
|
||||||
} else {
|
} else {
|
||||||
// TODO: write binary
|
// TODO: write binary
|
||||||
|
|||||||
Reference in New Issue
Block a user