mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-03-01 16:40:32 +00:00
[noci] try something new
This commit is contained in:
parent
a818dfaf59
commit
79611638f9
@ -294,7 +294,7 @@ proc cleanupConn(c: ConnManager, conn: Connection) {.async.} =
|
|||||||
|
|
||||||
trace "Connection cleaned up", conn
|
trace "Connection cleaned up", conn
|
||||||
|
|
||||||
proc onConnUpgraded(c: ConnManager, conn: Connection) {.async.} =
|
proc onConnUpgraded*(c: ConnManager, conn: Connection) {.async.} =
|
||||||
try:
|
try:
|
||||||
trace "Triggering connect events", conn
|
trace "Triggering connect events", conn
|
||||||
conn.upgrade()
|
conn.upgrade()
|
||||||
@ -469,8 +469,6 @@ proc storeMuxer*(c: ConnManager,
|
|||||||
trace "Stored muxer",
|
trace "Stored muxer",
|
||||||
muxer, handle = not handle.isNil, connections = c.conns.len
|
muxer, handle = not handle.isNil, connections = c.conns.len
|
||||||
|
|
||||||
asyncSpawn c.onConnUpgraded(muxer.connection)
|
|
||||||
|
|
||||||
proc getStream*(c: ConnManager,
|
proc getStream*(c: ConnManager,
|
||||||
peerId: PeerId,
|
peerId: PeerId,
|
||||||
dir: Direction): Future[Connection] {.async, gcsafe.} =
|
dir: Direction): Future[Connection] {.async, gcsafe.} =
|
||||||
|
@ -71,7 +71,10 @@ proc mux*(
|
|||||||
# install stream handler
|
# install stream handler
|
||||||
muxer.streamHandler = self.streamHandler
|
muxer.streamHandler = self.streamHandler
|
||||||
|
|
||||||
let handler = muxer.handle()
|
self.connManager.storeConn(conn)
|
||||||
|
|
||||||
|
# store it in muxed connections if we have a peer for it
|
||||||
|
self.connManager.storeMuxer(muxer, muxer.handle()) # store muxer and start read loop
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.identify(muxer)
|
await self.identify(muxer)
|
||||||
@ -81,10 +84,7 @@ proc mux*(
|
|||||||
# loop
|
# loop
|
||||||
debug "Could not identify connection", conn, msg = exc.msg
|
debug "Could not identify connection", conn, msg = exc.msg
|
||||||
|
|
||||||
self.connManager.storeConn(conn)
|
await self.connManager.onConnUpgraded(muxer.connection)
|
||||||
|
|
||||||
# store it in muxed connections if we have a peer for it
|
|
||||||
self.connManager.storeMuxer(muxer, handler) # store muxer and start read loop
|
|
||||||
|
|
||||||
return muxer
|
return muxer
|
||||||
|
|
||||||
@ -176,6 +176,12 @@ proc muxerHandler(
|
|||||||
let
|
let
|
||||||
conn = muxer.connection
|
conn = muxer.connection
|
||||||
|
|
||||||
|
# store incoming connection
|
||||||
|
self.connManager.storeConn(conn)
|
||||||
|
|
||||||
|
# store muxer and muxed connection
|
||||||
|
self.connManager.storeMuxer(muxer)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.identify(muxer)
|
await self.identify(muxer)
|
||||||
when defined(libp2p_agents_metrics):
|
when defined(libp2p_agents_metrics):
|
||||||
@ -199,11 +205,7 @@ proc muxerHandler(
|
|||||||
await muxer.close()
|
await muxer.close()
|
||||||
trace "Exception in muxer handler", conn, msg = exc.msg
|
trace "Exception in muxer handler", conn, msg = exc.msg
|
||||||
|
|
||||||
# store incoming connection
|
await self.connManager.onConnUpgraded(muxer.connection)
|
||||||
self.connManager.storeConn(conn)
|
|
||||||
|
|
||||||
# store muxer and muxed connection
|
|
||||||
self.connManager.storeMuxer(muxer)
|
|
||||||
|
|
||||||
proc new*(
|
proc new*(
|
||||||
T: type MuxedUpgrade,
|
T: type MuxedUpgrade,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user