mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-23 11:27:51 +00:00
fix pingRemote
This commit is contained in:
parent
706dc03b3e
commit
1d9347ed23
@ -230,14 +230,21 @@ public class RNSPeer {
|
||||
/** Utility methods */
|
||||
public void pingRemote() {
|
||||
var link = this.peerLink;
|
||||
log.info("pinging remote: {}", link);
|
||||
var data = "ping".getBytes(UTF_8);
|
||||
link.setPacketCallback(this::linkPacketReceived);
|
||||
Packet pingPacket = new Packet(link, data);
|
||||
PacketReceipt packetReceipt = pingPacket.send();
|
||||
//packetReceipt.setTimeout(3L);
|
||||
packetReceipt.setTimeoutCallback(this::packetTimedOut);
|
||||
packetReceipt.setDeliveryCallback(this::packetDelivered);
|
||||
if (nonNull(link)) {
|
||||
if (peerLink.getStatus() == ACTIVE) {
|
||||
log.info("pinging remote: {}", link);
|
||||
var data = "ping".getBytes(UTF_8);
|
||||
link.setPacketCallback(this::linkPacketReceived);
|
||||
Packet pingPacket = new Packet(link, data);
|
||||
PacketReceipt packetReceipt = pingPacket.send();
|
||||
//packetReceipt.setTimeout(3L);
|
||||
packetReceipt.setTimeoutCallback(this::packetTimedOut);
|
||||
packetReceipt.setDeliveryCallback(this::packetDelivered);
|
||||
} else {
|
||||
log.info("can't send ping to a peer {} with (link) status: {}",
|
||||
Hex.encodeHexString(peerLink.getDestination().getHash()), peerLink.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void shutdownLink(Link link) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user