mirror of
https://github.com/logos-storage/nim-chronos.git
synced 2026-01-04 22:43:07 +00:00
Investigation of Linux freezes #2.
This commit is contained in:
parent
bb176ba574
commit
cf42a5455e
@ -633,9 +633,12 @@ elif unixPlatform:
|
||||
|
||||
proc continuation(udata: pointer) =
|
||||
if SocketHandle(fd) in loop.selector:
|
||||
echo "closeSocket() continuation unregistering"
|
||||
unregister(fd)
|
||||
echo "closeSocket() continuation close()"
|
||||
close(SocketHandle(fd))
|
||||
if not isNil(aftercb):
|
||||
echo "closeSocket() invoke user-callback"
|
||||
aftercb(nil)
|
||||
|
||||
withData(loop.selector, int(fd), adata) do:
|
||||
@ -645,10 +648,12 @@ elif unixPlatform:
|
||||
# from system queue for this reader and writer.
|
||||
|
||||
if not(isNil(adata.reader.function)):
|
||||
echo "closeSocket() scheduling reader"
|
||||
loop.callbacks.addLast(adata.reader)
|
||||
adata.reader = default(AsyncCallback)
|
||||
|
||||
if not(isNil(adata.writer.function)):
|
||||
echo "closeSocket() scheduling writer"
|
||||
loop.callbacks.addLast(adata.writer)
|
||||
adata.writer = default(AsyncCallback)
|
||||
|
||||
@ -656,6 +661,7 @@ elif unixPlatform:
|
||||
# in such case processing queue will stuck on poll() call, because there
|
||||
# can be no file descriptors registered in system queue.
|
||||
var acb = AsyncCallback(function: continuation)
|
||||
echo "closeSocket() scheduling actual close"
|
||||
loop.callbacks.addLast(acb)
|
||||
|
||||
proc closeHandle*(fd: AsyncFD, aftercb: CallbackFunc = nil) {.inline.} =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user