[FIX] rpc: honor *_interface options + log it

bzr revid: odo@openerp.com-20110925014243-0q1o67twburpga0z
This commit is contained in:
Olivier Dony 2011-09-25 03:42:43 +02:00
parent 404e545365
commit da705a6b55
2 changed files with 9 additions and 5 deletions

View File

@ -108,7 +108,7 @@ class TinySocketServerThread(threading.Thread,netsvc.Server):
self.socket.listen(5)
self.threads = []
netsvc.Logger().notifyChannel("web-services", netsvc.LOG_INFO,
"starting NET-RPC service at %s port %d" % (interface or '0.0.0.0', port,))
"starting NET-RPC service on %s:%s" % (interface or '0.0.0.0', port,))
def run(self):
try:

View File

@ -302,14 +302,18 @@ def serve():
global httpd
# TODO Change the xmlrpc_port option to http_port.
# TODO Change the xmlrpc_* options to http_*
interface = config['xmlrpc_interface'] or '0.0.0.0'
port = config['xmlrpc_port']
try:
import werkzeug.serving
httpd = werkzeug.serving.make_server('0.0.0.0', config['xmlrpc_port'], application, threaded=True)
httpd = werkzeug.serving.make_server(interface, port, application, threaded=True)
logging.getLogger('wsgi').info('HTTP service (werkzeug) running on %s:%s', interface, port)
except ImportError, e:
import wsgiref.simple_server
logging.getLogger('wsgi').warn('Can not import werkzeug, ' 'falling back to wsgiref.')
httpd = wsgiref.simple_server.make_server('0.0.0.0', config['xmlrpc_port'], application)
logging.getLogger('wsgi').warn('Werkzeug module unavailable, falling back to wsgiref.')
httpd = wsgiref.simple_server.make_server(interface, port, application)
logging.getLogger('wsgi').info('HTTP service (wsgiref) running on %s:%s', interface, port)
httpd.serve_forever()