Fix cancellation race when connect() call is getting cancelled. (#101)
This commit is contained in:
parent
bce0f878d1
commit
d6d0084333
|
@ -722,7 +722,8 @@ when defined(windows):
|
|||
GC_unref(ovl)
|
||||
|
||||
proc cancel(udata: pointer) {.gcsafe.} =
|
||||
sock.closeSocket()
|
||||
if not(retFuture.finished()):
|
||||
sock.closeSocket()
|
||||
|
||||
povl = RefCustomOverlapped()
|
||||
GC_ref(povl)
|
||||
|
@ -1250,7 +1251,8 @@ else:
|
|||
retFuture.complete(transp)
|
||||
|
||||
proc cancel(udata: pointer) {.gcsafe.} =
|
||||
closeSocket(sock)
|
||||
if not(retFuture.finished()):
|
||||
closeSocket(sock)
|
||||
|
||||
while true:
|
||||
var res = posix.connect(SocketHandle(sock),
|
||||
|
|
Loading…
Reference in New Issue