summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/prserv/serv.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/prserv/serv.py')
-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 a4ae229134..1303f12b45 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -62,9 +62,6 @@ class PRServer(SimpleXMLRPCServer):
62 self.register_function(self.importone, "importone") 62 self.register_function(self.importone, "importone")
63 self.register_introspection_functions() 63 self.register_introspection_functions()
64 64
65 self.db = prserv.db.PRData(self.dbfile)
66 self.table = self.db["PRMAIN"]
67
68 self.requestqueue = Queue.Queue() 65 self.requestqueue = Queue.Queue()
69 self.handlerthread = threading.Thread(target = self.process_request_thread) 66 self.handlerthread = threading.Thread(target = self.process_request_thread)
70 self.handlerthread.daemon = False 67 self.handlerthread.daemon = False
@@ -100,10 +97,12 @@ class PRServer(SimpleXMLRPCServer):
100 self.table.sync_if_dirty() 97 self.table.sync_if_dirty()
101 98
102 def sigint_handler(self, signum, stack): 99 def sigint_handler(self, signum, stack):
103 self.table.sync() 100 if self.table:
101 self.table.sync()
104 102
105 def sigterm_handler(self, signum, stack): 103 def sigterm_handler(self, signum, stack):
106 self.table.sync() 104 if self.table:
105 self.table.sync()
107 raise SystemExit 106 raise SystemExit
108 107
109 def process_request(self, request, client_address): 108 def process_request(self, request, client_address):
@@ -145,6 +144,10 @@ class PRServer(SimpleXMLRPCServer):
145 144
146 bb.utils.set_process_name("PRServ") 145 bb.utils.set_process_name("PRServ")
147 146
147 # DB connection must be created after all forks
148 self.db = prserv.db.PRData(self.dbfile)
149 self.table = self.db["PRMAIN"]
150
148 logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" % 151 logger.info("Started PRServer with DBfile: %s, IP: %s, PORT: %s, PID: %s" %
149 (self.dbfile, self.host, self.port, str(os.getpid()))) 152 (self.dbfile, self.host, self.port, str(os.getpid())))
150 153