mirror of
https://github.com/logos-storage/logos-storage-nim-dht.git
synced 2026-05-21 17:19:27 +00:00
Move the client mode check at the beginning of the proc
This commit is contained in:
parent
f43580c713
commit
0f4c509ef3
@ -411,6 +411,13 @@ proc handleGetProviders(
|
||||
|
||||
proc handleMessage(d: Protocol, srcId: NodeId, fromAddr: Address,
|
||||
message: Message) =
|
||||
|
||||
if message.clientMode:
|
||||
let node = d.routingTable.getNode(srcId)
|
||||
if node.isSome:
|
||||
d.routingTable.removeNode(node.get)
|
||||
trace "Node removed from routing table after handling message", srcId
|
||||
|
||||
case message.kind
|
||||
of ping:
|
||||
dht_message_requests_incoming.inc()
|
||||
@ -445,12 +452,6 @@ proc handleMessage(d: Protocol, srcId: NodeId, fromAddr: Address,
|
||||
trace "Timed out or unrequested message", kind = message.kind,
|
||||
origin = fromAddr
|
||||
|
||||
if message.clientMode:
|
||||
let node = d.routingTable.getNode(srcId)
|
||||
if node.isSome:
|
||||
d.routingTable.removeNode(node.get)
|
||||
trace "Node removed from routing table after handling message", srcId
|
||||
|
||||
proc registerTalkProtocol*(d: Protocol, protocolId: seq[byte],
|
||||
protocol: TalkProtocol): DiscResult[void] =
|
||||
# Currently allow only for one handler per talk protocol.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user