small sugar

This commit is contained in:
Giovanni Petrantoni 2020-07-16 21:59:33 +09:00
parent b0fa68022a
commit 19d3d57d4c
2 changed files with 14 additions and 8 deletions

View File

@ -147,10 +147,10 @@ func `==`*(a, b: PeerInfo): bool =
bptr = cast[pointer](b)
if isNil(aptr) and isNil(bptr):
return true
if isNil(aptr) or isNil(bptr):
return false
if aptr == bptr and a.peerId == b.peerId:
return true
true
elif isNil(aptr) or isNil(bptr):
false
elif aptr == bptr and a.peerId == b.peerId:
true
else:
false

View File

@ -65,7 +65,13 @@ func `==`*(a, b: PubSubPeer): bool =
bptr = cast[pointer](b)
if isNil(aptr) and isNil(bptr):
return true
true
elif isNil(aptr) or isNil(bptr):
false
elif aptr == bptr and a.peerInfo == b.peerInfo:
true
else:
false
proc id*(p: PubSubPeer): string = p.peerInfo.id