Fixes compilation of asyncio2 on Windows.

Added a close(PDispatcher, TSocketHandle) implementation which unregisters
the handle.
This commit is contained in:
Dominik Picheta
2014-03-14 20:18:51 +00:00
parent 1a75b17cd0
commit afb7dbf81a

View File

@@ -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