Skip to content

Commit

Permalink
fix: doesn't fail loop fut if it is already finished (#50)
Browse files Browse the repository at this point in the history
It was raising a defect on nim-libp2p tests sometimes as a future can't
fail if it is already finished.
  • Loading branch information
diegomrsantos authored Sep 3, 2024
1 parent 7e450f1 commit 57562b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion quic/connection.nim
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ proc startSending(connection: Connection, remote: TransportAddress) =
except TransportError as e:
trace "Failed to send datagram", errorMsg = e.msg
trace "Failing connection loop future with error"
connection.loop.fail(e) # This might need to be revisited, see https://github.com/status-im/nim-quic/pull/41 for more details
if not connection.loop.finished:
connection.loop.fail(e) # This might need to be revisited, see https://github.com/status-im/nim-quic/pull/41 for more details
await connection.drop()
connection.loop = asyncLoop(send)

Expand Down

0 comments on commit 57562b7

Please sign in to comment.