From 106ae65e3205093e4a675c644251b4f5adeb127c Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Mon, 19 Jun 2023 12:13:39 +0200 Subject: [PATCH] add debug on Handshake timeour Signed-off-by: Csaba Kiraly --- libp2pdht/private/eth/p2p/discoveryv5/transport.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libp2pdht/private/eth/p2p/discoveryv5/transport.nim b/libp2pdht/private/eth/p2p/discoveryv5/transport.nim index 4a55b01..7299423 100644 --- a/libp2pdht/private/eth/p2p/discoveryv5/transport.nim +++ b/libp2pdht/private/eth/p2p/discoveryv5/transport.nim @@ -95,12 +95,15 @@ proc sendWhoareyou(t: Transport, toId: NodeId, a: Address, sleepAsync(handshakeTimeout).addCallback() do(data: pointer): # TODO: should we still provide cancellation in case handshake completes # correctly? - t.codec.handshakes.del(key) + if t.codec.hasHandshake(key): + debug "Handshake timeout", myport = t.bindAddress.port , dstId = toId, address = a + t.codec.handshakes.del(key) trace "Send whoareyou", dstId = toId, address = a t.sendToA(a, data) else: - debug "Node with this id already has ongoing handshake, ignoring packet" + # TODO: is this reasonable to drop it? Should we allow a mini-queue here? + debug "Node with this id already has ongoing handshake, ignoring packet", myport = t.bindAddress.port , dstId = toId, address = a proc receive*(t: Transport, a: Address, packet: openArray[byte]) = let decoded = t.codec.decodePacket(a, packet)