From 0cba5968c24f14482127ef1736de932ce6481cfa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 May 2015 19:16:14 +0530 Subject: [PATCH] ... --- src/calibre/srv/async.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/async.py b/src/calibre/srv/async.py index 841775272d..d02b8db798 100644 --- a/src/calibre/srv/async.py +++ b/src/calibre/srv/async.py @@ -12,7 +12,7 @@ from io import BytesIO from calibre import as_unicode from calibre.srv.opts import Options from calibre.srv.utils import ( - socket_errors_socket_closed, socket_errors_nonblocking) + socket_errors_socket_closed, socket_errors_nonblocking, HandleInterrupt) from calibre.utils.socket_inheritance import set_socket_inherit from calibre.utils.logging import ThreadSafeLog from calibre.utils.monotonic import monotonic @@ -331,4 +331,6 @@ class EchoLine(Connection): self.rbuf.seek(pos + sent) if __name__ == '__main__': - ServerLoop(EchoLine).serve_forever() + s = ServerLoop(EchoLine) + with HandleInterrupt(s.wakeup): + s.serve_forever()