diff --git a/libp2p/identify.nim b/libp2p/identify.nim index 83464afba..931153feb 100644 --- a/libp2p/identify.nim +++ b/libp2p/identify.nim @@ -80,7 +80,7 @@ proc decodeMsg*(buf: seq[byte]): IdentifyInfo = discard pb.getString(6, result.agentVersion) method init*(p: Identify) = - proc handle(conn: Connection, proto: string) {.async, gcsafe.} = + proc handle(conn: Connection, proto: string) {.async, gcsafe, closure.} = var pb = encodeMsg(p.peerInfo, await conn.getObservedAddrs()) await conn.writeLp(pb.buffer) diff --git a/libp2p/protocol.nim b/libp2p/protocol.nim index 2c238da2a..1daa17fd6 100644 --- a/libp2p/protocol.nim +++ b/libp2p/protocol.nim @@ -14,12 +14,12 @@ import connection, transport, type LPProtoHandler* = proc (conn: Connection, proto: string): - Future[void] {.gcsafe.} + Future[void] {.gcsafe, closure.} LPProtocol* = ref object of RootObj peerInfo*: PeerInfo codec*: string - handler*: LPProtoHandler + handler*: LPProtoHandler ## this handler gets invoked by the protocol negotiator proc newProtocol*(p: typedesc[LPProtocol], peerInfo: PeerInfo): p =