Retry internet connections if all nodes disconnected
This commit is contained in:
parent
75d87b54c2
commit
a22b32f607
1 changed files with 6 additions and 1 deletions
|
@ -63,7 +63,7 @@ private[core] class InternetInterface(connectionHandler: ConnectionHandler, cryp
|
||||||
.map(_.trim())
|
.map(_.trim())
|
||||||
.filterNot(_.isEmpty)
|
.filterNot(_.isEmpty)
|
||||||
|
|
||||||
Random.shuffle(addresses.toList)
|
addresses.toList
|
||||||
.foreach(openConnection)
|
.foreach(openConnection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,11 @@ private[core] class InternetInterface(connectionHandler: ConnectionHandler, cryp
|
||||||
addressDeviceMap -= ad
|
addressDeviceMap -= ad
|
||||||
val connectionDuration = new Duration(connectionThread.connectionOpened, DateTime.now)
|
val connectionDuration = new Duration(connectionThread.connectionOpened, DateTime.now)
|
||||||
connectionHandler.onConnectionClosed(ad, connectionDuration)
|
connectionHandler.onConnectionClosed(ad, connectionDuration)
|
||||||
|
|
||||||
|
// If we aren't connected to any nodes, try to connect again.
|
||||||
|
if (connections.isEmpty) {
|
||||||
|
openAllConnections()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue