new libp2p API

This commit is contained in:
Ștefan Talpalaru 2020-01-13 20:26:19 +01:00
parent 5d1e20012a
commit 2f68ee0ffe
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 4 additions and 4 deletions

View File

@ -105,8 +105,8 @@ template openStream(node: Eth2Node, peer: Peer, protocolId: string): untyped =
dial(node.switch, peer.info, protocolId)
proc peer(stream: P2PStream): PeerID =
# TODO: Can this be `none`?
stream.peerInfo.get.peerId
# TODO: Can this be `nil`?
stream.peerInfo.peerId
#
# End of compatibility layer
@ -120,8 +120,8 @@ proc getPeer*(node: Eth2Node, peerInfo: PeerInfo): Peer {.gcsafe.} =
node.peers[peerId] = result
proc peerFromStream(network: Eth2Node, stream: P2PStream): Peer {.gcsafe.} =
# TODO: Can this be `none`?
return network.getPeer(stream.peerInfo.get)
# TODO: Can this be `nil`?
return network.getPeer(stream.peerInfo)
proc disconnect*(peer: Peer, reason: DisconnectionReason, notifyOtherPeer = false) {.async.} =
# TODO: How should we notify the other peer?