Skip to content

Commit ceabad6

Browse files
Update with PR suggestions.
1 parent 3e56745 commit ceabad6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libp2p/switch.nim

+4-3
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ proc upgradeMonitor(
234234
finally:
235235
upgrades.release()
236236

237-
proc accept_cleanup(upgrades: AsyncSemaphore, connection: Connection) {.async.} =
237+
proc acceptCleanup(upgrades: AsyncSemaphore, connection: Connection) {.async.} =
238238
upgrades.release() # always release the slot
239239
if not isNil(connection):
240240
await connection.close()
@@ -279,11 +279,12 @@ proc accept(s: Switch, transport: Transport) {.async.} = # noraises
279279
trace "releasing semaphore on cancellation"
280280
upgrades.release() # always release the slot
281281
except TransportUseClosedError:
282-
await accept_cleanup(upgrades, conn)
282+
trace "Graceful shutdown in accept loop, exiting"
283+
await acceptCleanup(upgrades, conn)
283284
return
284285
except CatchableError as exc:
285286
error "Exception in accept loop, exiting", exc = exc.msg
286-
await accept_cleanup(upgrades, conn)
287+
await acceptCleanup(upgrades, conn)
287288
return
288289

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

0 commit comments

Comments
 (0)