make AsyncSocket.getPeerAddr work ; fix #15022 (#20038)

Signed-off-by: David Krause <enthus1ast@users.noreply.github.com>
This commit is contained in:
David Krause 2022-07-16 11:59:58 +02:00 • committed by GitHub
commit 60dd38c502
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1733,6 +1733,8 @@ when defined(windows) or defined(nimdoc):
proc (fd: AsyncFD, bytesCount: DWORD, errcode: OSErrorCode) = proc (fd: AsyncFD, bytesCount: DWORD, errcode: OSErrorCode) =
if not retFuture.finished: if not retFuture.finished:
if errcode == OSErrorCode(-1): if errcode == OSErrorCode(-1):
const SO_UPDATE_CONNECT_CONTEXT = 0x7010
socket.SocketHandle.setSockOptInt(SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, 1) # 15022
retFuture.complete() retFuture.complete()
else: else:
retFuture.fail(newException(OSError, osErrorMsg(errcode))) retFuture.fail(newException(OSError, osErrorMsg(errcode)))