summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/prserv
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/prserv')
-rw-r--r--bitbake/lib/prserv/serv.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index 5c0ffb9925..3cb2e03dad 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -3,6 +3,7 @@ import signal, time
3from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler 3from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
4import threading 4import threading
5import Queue 5import Queue
6import socket
6 7
7try: 8try:
8 import sqlite3 9 import sqlite3
@@ -37,7 +38,6 @@ singleton = None
37class PRServer(SimpleXMLRPCServer): 38class PRServer(SimpleXMLRPCServer):
38 def __init__(self, dbfile, logfile, interface, daemon=True): 39 def __init__(self, dbfile, logfile, interface, daemon=True):
39 ''' constructor ''' 40 ''' constructor '''
40 import socket
41 try: 41 try:
42 SimpleXMLRPCServer.__init__(self, interface, 42 SimpleXMLRPCServer.__init__(self, interface,
43 logRequests=False, allow_none=True) 43 logRequests=False, allow_none=True)
@@ -289,7 +289,8 @@ class PRServerConnection(object):
289 return self.host, self.port 289 return self.host, self.port
290 290
291def start_daemon(dbfile, host, port, logfile): 291def start_daemon(dbfile, host, port, logfile):
292 pidfile = PIDPREFIX % (host, port) 292 ip = socket.gethostbyname(host)
293 pidfile = PIDPREFIX % (ip, port)
293 try: 294 try:
294 pf = file(pidfile,'r') 295 pf = file(pidfile,'r')
295 pid = int(pf.readline().strip()) 296 pid = int(pf.readline().strip())
@@ -302,12 +303,14 @@ def start_daemon(dbfile, host, port, logfile):
302 % pidfile) 303 % pidfile)
303 return 1 304 return 1
304 305
305 server = PRServer(os.path.abspath(dbfile), os.path.abspath(logfile), (host,port)) 306 server = PRServer(os.path.abspath(dbfile), os.path.abspath(logfile), (ip,port))
306 server.start() 307 server.start()
308
307 return 0 309 return 0
308 310
309def stop_daemon(host, port): 311def stop_daemon(host, port):
310 pidfile = PIDPREFIX % (host, port) 312 ip = socket.gethostbyname(host)
313 pidfile = PIDPREFIX % (ip, port)
311 try: 314 try:
312 pf = file(pidfile,'r') 315 pf = file(pidfile,'r')
313 pid = int(pf.readline().strip()) 316 pid = int(pf.readline().strip())
@@ -320,7 +323,7 @@ def stop_daemon(host, port):
320 % pidfile) 323 % pidfile)
321 324
322 try: 325 try:
323 PRServerConnection(host, port).terminate() 326 PRServerConnection(ip, port).terminate()
324 except: 327 except:
325 logger.critical("Stop PRService %s:%d failed" % (host,port)) 328 logger.critical("Stop PRService %s:%d failed" % (host,port))
326 329