Skip to content

Commit

Permalink
fix: reset accept fut in stop (#1082)
Browse files Browse the repository at this point in the history
Co-authored-by: diegomrsantos <diego@status.im>
  • Loading branch information
Ivansete-status and diegomrsantos authored Apr 17, 2024
1 parent 89cad5a commit b30b265
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libp2p/transports/tcptransport.nim
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ method stop*(self: TcpTransport) {.async.} =
await allFutures(toWait)

self.servers = @[]
self.acceptFuts = @[]

trace "Transport stopped"
untrackCounter(TcpTransportTrackerName)
Expand Down Expand Up @@ -221,6 +222,7 @@ method accept*(self: TcpTransport): Future[Connection] {.async.} =
let observedAddr = MultiAddress.init(transp.remoteAddress).tryGet()
return await self.connHandler(transp, Opt.some(observedAddr), Direction.In)
except CancelledError as exc:
debug "CancelledError", exc = exc.msg
transp.close()
raise exc
except CatchableError as exc:
Expand Down

0 comments on commit b30b265

Please sign in to comment.