diff options
Diffstat (limited to 'bitbake/lib/prserv')
-rw-r--r-- | bitbake/lib/prserv/serv.py | 13 |
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 | |||
3 | from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler | 3 | from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler |
4 | import threading | 4 | import threading |
5 | import Queue | 5 | import Queue |
6 | import socket | ||
6 | 7 | ||
7 | try: | 8 | try: |
8 | import sqlite3 | 9 | import sqlite3 |
@@ -37,7 +38,6 @@ singleton = None | |||
37 | class PRServer(SimpleXMLRPCServer): | 38 | class 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 | ||
291 | def start_daemon(dbfile, host, port, logfile): | 291 | def 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 | ||
309 | def stop_daemon(host, port): | 311 | def 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 | ||