Skip to content

Commit

Permalink
Update with PR suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCabeza authored and diegomrsantos committed Jun 25, 2024
1 parent e45c6ed commit 453bcc6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libp2p/switch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ proc upgradeMonitor(
finally:
upgrades.release()

proc accept_cleanup(upgrades: AsyncSemaphore, connection: Connection) {.async.} =
proc acceptCleanup(upgrades: AsyncSemaphore, connection: Connection) {.async.} =
upgrades.release() # always release the slot
if not isNil(connection):
await connection.close()
Expand Down Expand Up @@ -269,11 +269,12 @@ proc accept(s: Switch, transport: Transport) {.async.} = # noraises
upgrades.release() # always release the slot
return
except TransportUseClosedError:
await accept_cleanup(upgrades, conn)
trace "Graceful shutdown in accept loop, exiting"
await acceptCleanup(upgrades, conn)
return
except CatchableError as exc:
error "Exception in accept loop, exiting", exc = exc.msg
await accept_cleanup(upgrades, conn)
await acceptCleanup(upgrades, conn)
return

proc stop*(s: Switch) {.async, public.} =
Expand Down

0 comments on commit 453bcc6

Please sign in to comment.