comparison 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
comparison
equal deleted inserted replaced
7654:1471fcda252b 7655:91fad2d2c4b3
1165 1165
1166 try: 1166 try:
1167 httpd.serve_forever() 1167 httpd.serve_forever()
1168 except KeyboardInterrupt: 1168 except KeyboardInterrupt:
1169 print('Keyboard Interrupt: exiting') 1169 print('Keyboard Interrupt: exiting')
1170 try:
1171 httpd.socket.shutdown(socket.SHUT_RDWR)
1172 except OSError:
1173 # forced shutdown can throw an error.
1174 # we don't care as we are going away.
1175 pass
1170 httpd.socket.close() 1176 httpd.socket.close()
1171 1177
1172 1178
1173 if __name__ == '__main__': 1179 if __name__ == '__main__':
1174 run() 1180 run()

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