use cancelAndAwait to mitigate further hangs (#459)
This commit is contained in:
parent
a8f5f7a8bb
commit
3d44fcb8b3
|
@ -81,7 +81,7 @@ proc handleConn*(s: Secure,
|
|||
let futs = @[conn.join(), sconn.join()]
|
||||
await futs[0] or futs[1]
|
||||
for f in futs:
|
||||
if not f.finished: f.cancel # cancel outstanding join()
|
||||
if not f.finished: await f.cancelAndWait() # cancel outstanding join()
|
||||
|
||||
await allFuturesThrowing(
|
||||
sconn.close(), conn.close())
|
||||
|
|
|
@ -88,7 +88,7 @@ proc connHandler*(t: TcpTransport,
|
|||
let futs = @[client.join(), conn.join()]
|
||||
await futs[0] or futs[1]
|
||||
for f in futs:
|
||||
if not f.finished: f.cancel # cancel outstanding join()
|
||||
if not f.finished: await f.cancelAndWait() # cancel outstanding join()
|
||||
|
||||
trace "Cleaning up client", addrs = $client.remoteAddress,
|
||||
conn
|
||||
|
|
Loading…
Reference in New Issue