Investigation of Linux freezes #3.
This commit is contained in:
parent
cf42a5455e
commit
f1b43aeb04
|
@ -274,12 +274,15 @@ proc failPendingWriteQueue(queue: var Deque[StreamVector],
|
||||||
vector.writer.fail(error)
|
vector.writer.fail(error)
|
||||||
|
|
||||||
proc clean(server: StreamServer) {.inline.} =
|
proc clean(server: StreamServer) {.inline.} =
|
||||||
|
echo "cleaning server instance"
|
||||||
if not(server.loopFuture.finished()):
|
if not(server.loopFuture.finished()):
|
||||||
|
echo "cleaning server complete()"
|
||||||
untrackServer(server)
|
untrackServer(server)
|
||||||
server.loopFuture.complete()
|
server.loopFuture.complete()
|
||||||
if not isNil(server.udata) and GCUserData in server.flags:
|
if not isNil(server.udata) and GCUserData in server.flags:
|
||||||
GC_unref(cast[ref int](server.udata))
|
GC_unref(cast[ref int](server.udata))
|
||||||
GC_unref(server)
|
GC_unref(server)
|
||||||
|
echo "clean server exit"
|
||||||
|
|
||||||
proc clean(transp: StreamTransport) {.inline.} =
|
proc clean(transp: StreamTransport) {.inline.} =
|
||||||
if not(transp.future.finished()):
|
if not(transp.future.finished()):
|
||||||
|
@ -1639,9 +1642,8 @@ proc close*(server: StreamServer) =
|
||||||
## Please note that release of resources is not completed immediately, to be
|
## Please note that release of resources is not completed immediately, to be
|
||||||
## sure all resources got released please use ``await server.join()``.
|
## sure all resources got released please use ``await server.join()``.
|
||||||
proc continuation(udata: pointer) {.gcsafe.} =
|
proc continuation(udata: pointer) {.gcsafe.} =
|
||||||
# Stop tracking server
|
echo "server close() continuation"
|
||||||
if not(server.loopFuture.finished()):
|
server.clean()
|
||||||
server.clean()
|
|
||||||
|
|
||||||
let r1 = (server.status == ServerStatus.Stopped) and
|
let r1 = (server.status == ServerStatus.Stopped) and
|
||||||
not(isNil(server.function))
|
not(isNil(server.function))
|
||||||
|
|
Loading…
Reference in New Issue