diff --git a/source/agora/node/main.d b/source/agora/node/main.d index 04367bc9e4d..f47f91a2dfe 100644 --- a/source/agora/node/main.d +++ b/source/agora/node/main.d @@ -226,6 +226,7 @@ private SigHandlerT getSignalHandler () @safe pure nothrow @nogc { try { + printf("shutting down HTTP listener.\n"); l.stopListening(); l = typeof(l).init; } @@ -240,6 +241,25 @@ private SigHandlerT getSignalHandler () @safe pure nothrow @nogc } } } + foreach (ref l; listeners.tcp) + { + try + { + printf("shutting down TCP listener.\n"); + l.stopListening(); + l = typeof(l).init; + } + catch (Exception exc) + { + printf("Exception thrown while stopping a TCP listener: %.*s\n", + cast(int) exc.msg.length, exc.msg.ptr); + debug { + scope (failure) assert(0); + writeln("========================================"); + writeln("Full stack trace: ", exc); + } + } + } printf("Calling node shutdown procedure...\n"); if (listeners.node !is null)