From a26ffa154c3bd865c782c6113157698e9a8d587d Mon Sep 17 00:00:00 2001 From: Adriana Draghici Date: Fri, 19 Mar 2010 12:58:21 +0000 Subject: [PATCH] server: indent stuff --- bt_comm/server/Server.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/bt_comm/server/Server.py b/bt_comm/server/Server.py index 52aab51..4da3f7a 100644 --- a/bt_comm/server/Server.py +++ b/bt_comm/server/Server.py @@ -21,6 +21,7 @@ WAITING_STATUS_DATA = 5 DEBUG = True + def recv_pickled_data(clientsock): # while chunk: # chunk = clientsock.recv(BUFFER_SIZE) @@ -144,25 +145,27 @@ def doServer(ip, port): # recv_pickled_data(clientsock) clientsock.close() + class MyDaemon(Daemon): - def run(self, ip, port): - doServer(ip, port) + def run(self, ip, port): + doServer(ip, port) if __name__ == "__main__": + if len(sys.argv) == 4: daemon = MyDaemon('/tmp/daemon-example.pid', sys.argv[2], int(sys.argv[3])) - if 'start' == sys.argv[1]: - daemon.start() - elif 'stop' == sys.argv[1]: - daemon.stop() - elif 'restart' == sys.argv[1]: - daemon.restart() - else: - print "Unknown command" - sys.exit(2) - sys.exit(0) - else: - print "usage: %s start|stop|restart " % sys.argv[0] - sys.exit(2) + if 'start' == sys.argv[1]: + daemon.start() + elif 'stop' == sys.argv[1]: + daemon.stop() + elif 'restart' == sys.argv[1]: + daemon.restart() + else: + print "Unknown command" + sys.exit(2) + sys.exit(0) + else: + print "usage: %s start|stop|restart " % sys.argv[0] + sys.exit(2) -- 2.20.1