summaryrefslogtreecommitdiff
path: root/bin/tinyerp-server.py
diff options
context:
space:
mode:
authorced <>2007-01-25 12:30:41 +0000
committerced <>2007-01-25 12:30:41 +0000
commit4376abed3fb412f71e9ea781e370c2a9f8867985 (patch)
treee74da99d968dd5d8ad3d9ec13f4f1d6ae1f680f2 /bin/tinyerp-server.py
parent8676f58030b342f0497db9b0c894c277debe2677 (diff)
KERNEL: initial add of tinysocket
bzr revid: ced-46197cd2df22dc3b22288be8053614f71a95bf05
Diffstat (limited to 'bin/tinyerp-server.py')
-rwxr-xr-xbin/tinyerp-server.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/bin/tinyerp-server.py b/bin/tinyerp-server.py
index d55d4d20d49..87cf699d388 100755
--- a/bin/tinyerp-server.py
+++ b/bin/tinyerp-server.py
@@ -196,6 +196,7 @@ if tools.config["translate_in"]:
if tools.config["stop_after_init"]:
sys.exit(0)
+
#----------------------------------------------------------
# Launch Server
#----------------------------------------------------------
@@ -225,8 +226,29 @@ if not (netsvc.HAS_SSL and tools.config['secure']):
else:
logger.notifyChannel("web-services", netsvc.LOG_INFO, "You are using the SSL Layer")
-logger.notifyChannel("web-services", netsvc.LOG_INFO, 'the server is running, waiting for connections...')
+tinySocket = netsvc.TinySocketDaemon(interface, 8085, False)
+logger.notifyChannel("web-services", netsvc.LOG_INFO, "starting TinySocket service, port "+str(8085))
+
+def handler(signum, frame):
+ from tools import config
+ tinySocket.stop()
+ httpd.stop()
+ netsvc.Agent.quit()
+ if config['pidfile']:
+ os.unlink(config['pidfile'])
+ sys.exit(0)
+
+from tools import config
+if config['pidfile']:
+ fd=open(config['pidfile'], 'w')
+ pidtext="%d" % (os.getpid())
+ fd.write(pidtext)
+ fd.close()
+signal.signal(signal.SIGINT, handler)
+signal.signal(signal.SIGTERM, handler)
+logger.notifyChannel("web-services", netsvc.LOG_INFO, 'the server is running, waiting for connections...')
+tinySocket.start()
httpd.start()
dispatcher.run()