Skip to content

Commit 9e6c4cb

Browse files
fix: properly handle CancelledError in switch accept loop (#1537)
Signed-off-by: MorganaFuture <andrewmochalskyi@gmail.com>
1 parent 5f25604 commit 9e6c4cb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

libp2p/switch.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ proc accept(s: Switch, transport: Transport) {.async: (raises: []).} =
273273
conn =
274274
try:
275275
await transport.accept()
276+
except CancelledError as exc:
277+
slot.release()
278+
raise exc
276279
except CatchableError as exc:
277280
slot.release()
278281
raise

0 commit comments

Comments
 (0)