mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
Fixes compilation of asyncio2 on Windows.
Added a close(PDispatcher, TSocketHandle) implementation which unregisters the handle.
This commit is contained in:
@@ -132,7 +132,6 @@ when defined(windows) or defined(nimdoc):
|
||||
cast[TCompletionKey](sock), 1) == 0:
|
||||
OSError(OSLastError())
|
||||
p.handles.incl(sock)
|
||||
# TODO: fd closure detection, we need to remove the fd from handles set
|
||||
|
||||
proc verifyPresence(p: PDispatcher, sock: TSocketHandle) =
|
||||
## Ensures that socket has been registered with the dispatcher.
|
||||
@@ -475,6 +474,11 @@ when defined(windows) or defined(nimdoc):
|
||||
result = socket(domain, typ, protocol)
|
||||
disp.register(result)
|
||||
|
||||
proc close*(disp: PDispatcher, socket: TSocketHandle) =
|
||||
## Closes a socket and ensures that it is unregistered.
|
||||
socket.close()
|
||||
disp.handles.excl(socket)
|
||||
|
||||
initAll()
|
||||
else:
|
||||
import selectors
|
||||
|
||||
Reference in New Issue
Block a user