forked from Qortal/qortal
Save lastConnected for outbound peers on completed handshake
This commit is contained in:
parent
840f52ff90
commit
f45cedb6ff
@ -617,6 +617,15 @@ public class Network extends Thread {
|
||||
// Make a note that we've successfully completed handshake (and when)
|
||||
peer.getPeerData().setLastConnected(NTP.getTime());
|
||||
|
||||
// Update connection info for outbound peers only
|
||||
if (peer.isOutbound())
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
repository.getNetworkRepository().save(peer.getPeerData());
|
||||
repository.saveChanges();
|
||||
} catch (DataException e) {
|
||||
LOGGER.warn(String.format("Repository issue while trying to update outbound peer %s", peer));
|
||||
}
|
||||
|
||||
// Start regular pings
|
||||
peer.startPings();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user