Update with PR suggestions.

This commit is contained in:
Álex Cabeza Romero 2024-03-15 16:39:35 +01:00 committed by Diego
parent e45c6ede93
commit 453bcc6f92
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806
1 changed files with 4 additions and 3 deletions

View File

@ -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()
@ -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.} =