|
@@ -321,7 +321,22 @@ class ProcessServer():
|
|
bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout)
|
|
bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout)
|
|
seendata = True
|
|
seendata = True
|
|
|
|
|
|
- ready = self.idle_commands(.1, fds)
|
|
|
|
|
|
+ if not self.idle:
|
|
|
|
+ self.idle = threading.Thread(target=self.idle_thread)
|
|
|
|
+ self.idle.start()
|
|
|
|
+ elif self.idle and not self.idle.is_alive():
|
|
|
|
+ serverlog("Idle thread terminated, main thread exiting too")
|
|
|
|
+ bb.error("Idle thread terminated, main thread exiting too")
|
|
|
|
+ self.quit = True
|
|
|
|
+
|
|
|
|
+ nextsleep = 0.1
|
|
|
|
+ if self.xmlrpc:
|
|
|
|
+ nextsleep = self.xmlrpc.get_timeout(nextsleep)
|
|
|
|
+ try:
|
|
|
|
+ ready = select.select(fds,[],[],nextsleep)[0]
|
|
|
|
+ except InterruptedError:
|
|
|
|
+ # Ignore EINTR
|
|
|
|
+ ready = []
|
|
|
|
|
|
if self.idle:
|
|
if self.idle:
|
|
self.idle.join()
|
|
self.idle.join()
|
|
@@ -485,31 +500,6 @@ class ProcessServer():
|
|
if nextsleep is not None:
|
|
if nextsleep is not None:
|
|
select.select(fds,[],[],nextsleep)[0]
|
|
select.select(fds,[],[],nextsleep)[0]
|
|
|
|
|
|
- def idle_commands(self, delay, fds=None):
|
|
|
|
- nextsleep = delay
|
|
|
|
- if not fds:
|
|
|
|
- fds = []
|
|
|
|
-
|
|
|
|
- if not self.idle:
|
|
|
|
- self.idle = threading.Thread(target=self.idle_thread)
|
|
|
|
- self.idle.start()
|
|
|
|
- elif self.idle and not self.idle.is_alive():
|
|
|
|
- serverlog("Idle thread terminated, main thread exiting too")
|
|
|
|
- bb.error("Idle thread terminated, main thread exiting too")
|
|
|
|
- self.quit = True
|
|
|
|
-
|
|
|
|
- if nextsleep is not None:
|
|
|
|
- if self.xmlrpc:
|
|
|
|
- nextsleep = self.xmlrpc.get_timeout(nextsleep)
|
|
|
|
- try:
|
|
|
|
- return select.select(fds,[],[],nextsleep)[0]
|
|
|
|
- except InterruptedError:
|
|
|
|
- # Ignore EINTR
|
|
|
|
- return []
|
|
|
|
- else:
|
|
|
|
- return select.select(fds,[],[],0)[0]
|
|
|
|
-
|
|
|
|
-
|
|
|
|
class ServerCommunicator():
|
|
class ServerCommunicator():
|
|
def __init__(self, connection, recv):
|
|
def __init__(self, connection, recv):
|
|
self.connection = connection
|
|
self.connection = connection
|