comparison src/server/server.py @ 812:fd6965c16e7e

server: added "quit" method to exit with an exit code when reactor is running
author Goffi <goffi@goffi.org>
date Sun, 20 Dec 2015 20:01:40 +0100
parents 3905bc24eb17
children 6e27604ec95a
comparison
equal deleted inserted replaced
811:b1826adbeeff 812:fd6965c16e7e
1378 reactor.run() 1378 reactor.run()
1379 1379
1380 def stop(self): 1380 def stop(self):
1381 reactor.stop() 1381 reactor.stop()
1382 1382
1383 def quit(self, exit_code=None):
1384 """Exit app when reactor is running
1385
1386 @param exit_code(None, int): exit code
1387 """
1388 self.stop()
1389 sys.exit(exit_code or 0)
1390
1383 1391
1384 class RedirectToHTTPS(Resource): 1392 class RedirectToHTTPS(Resource):
1385 1393
1386 def __init__(self, old_port, new_port): 1394 def __init__(self, old_port, new_port):
1387 Resource.__init__(self) 1395 Resource.__init__(self)