diff roundup/scripts/roundup_server.py @ 7655:91fad2d2c4b3

fix: exit quickly on keyboard interrupt When exiting roundup_server (issue was seen in use of roundup_demo) using ^C, the keyboard interrupt message is generated but the application didn't exit until the 60 second socket timeout is complete. This seems to be more of an issue with Windows. With this change the socket is explicitly shut down telling the client what's happening. Then the file descriptor is closed.
author John Rouillard <rouilj@ieee.org>
date Fri, 06 Oct 2023 21:43:56 -0400
parents dba4b1b25528
children 5a35cfee727a
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py	Fri Oct 06 20:45:25 2023 -0400
+++ b/roundup/scripts/roundup_server.py	Fri Oct 06 21:43:56 2023 -0400
@@ -1167,6 +1167,12 @@
         httpd.serve_forever()
     except KeyboardInterrupt:
         print('Keyboard Interrupt: exiting')
+        try:
+            httpd.socket.shutdown(socket.SHUT_RDWR)
+        except OSError:
+            # forced shutdown can throw an error.
+            # we don't care as we are going away.
+            pass
         httpd.socket.close()
 
 

Roundup Issue Tracker: http://roundup-tracker.org/