aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-03-12 17:02:26 +0500
committerEgor Tensin <Egor.Tensin@gmail.com>2022-03-12 17:02:26 +0500
commit6afcbb3ca54bf5242ba8a88f6bbc8b3bb7611e4c (patch)
tree43b30aac9f3d5c5fcc4acfa5d7c3d021579727f8
parentREADME: update (diff)
downloadvoid-6afcbb3ca54bf5242ba8a88f6bbc8b3bb7611e4c.tar.gz
void-6afcbb3ca54bf5242ba8a88f6bbc8b3bb7611e4c.zip
server.py: minor refactoring
-rwxr-xr-xserver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/server.py b/server.py
index 9fa7530..c0b8fc5 100755
--- a/server.py
+++ b/server.py
@@ -59,6 +59,11 @@ def handle_sigterm(signum, frame):
set_exiting()
+def handle_sigint():
+ print('\nKeyboard interrupt received, exiting...')
+ set_exiting()
+
+
@contextmanager
def setup_signal_handlers(httpd):
handler_thread = SignalHandler(httpd)
@@ -119,8 +124,7 @@ def main(args=None):
try:
httpd.serve_forever()
except KeyboardInterrupt:
- print('\nKeyboard interrupt received, exiting...')
- set_exiting()
+ handle_sigint()
if __name__ == '__main__':