mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-01-11 13:34:26 +00:00
fix PubSubPeer hashing issues
This commit is contained in:
parent
45300c28a9
commit
fae38e0146
@ -64,8 +64,10 @@ type
|
|||||||
RPCHandler* = proc(peer: PubSubPeer, msg: RPCMsg): Future[void] {.gcsafe.}
|
RPCHandler* = proc(peer: PubSubPeer, msg: RPCMsg): Future[void] {.gcsafe.}
|
||||||
|
|
||||||
func hash*(p: PubSubPeer): Hash =
|
func hash*(p: PubSubPeer): Hash =
|
||||||
# int is either 32/64, so intptr basically, pubsubpeer is a ref
|
p.peerId.hash
|
||||||
cast[pointer](p).hash
|
|
||||||
|
func `==`*(a, b: PubSubPeer): bool =
|
||||||
|
a.peerId == b.peerId
|
||||||
|
|
||||||
func shortLog*(p: PubSubPeer): string =
|
func shortLog*(p: PubSubPeer): string =
|
||||||
if p.isNil: "PubSubPeer(nil)"
|
if p.isNil: "PubSubPeer(nil)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user