diff options
Diffstat (limited to 'bitbake/lib/bb/server/xmlrpc.py')
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index 641e15e833..cca569d0e9 100644 --- a/bitbake/lib/bb/server/xmlrpc.py +++ b/bitbake/lib/bb/server/xmlrpc.py | |||
@@ -264,12 +264,9 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer): | |||
264 | Serve Requests. Overloaded to honor a quit command | 264 | Serve Requests. Overloaded to honor a quit command |
265 | """ | 265 | """ |
266 | self.quit = False | 266 | self.quit = False |
267 | self.timeout = 0 # Run Idle calls for our first callback | ||
268 | while not self.quit: | 267 | while not self.quit: |
269 | #print "Idle queue length %s" % len(self._idlefuns) | 268 | fds = [self] |
270 | self.handle_request() | 269 | nextsleep = 0.1 |
271 | #print "Idle timeout, running idle functions" | ||
272 | nextsleep = None | ||
273 | for function, data in self._idlefuns.items(): | 270 | for function, data in self._idlefuns.items(): |
274 | try: | 271 | try: |
275 | retval = function(self, data, False) | 272 | retval = function(self, data, False) |
@@ -277,21 +274,22 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer): | |||
277 | del self._idlefuns[function] | 274 | del self._idlefuns[function] |
278 | elif retval is True: | 275 | elif retval is True: |
279 | nextsleep = 0 | 276 | nextsleep = 0 |
280 | elif nextsleep is 0: | 277 | else: |
281 | continue | 278 | fds = fds + retval |
282 | elif nextsleep is None: | ||
283 | nextsleep = retval | ||
284 | elif retval < nextsleep: | ||
285 | nextsleep = retval | ||
286 | except SystemExit: | 279 | except SystemExit: |
287 | raise | 280 | raise |
288 | except: | 281 | except: |
289 | import traceback | 282 | import traceback |
290 | traceback.print_exc() | 283 | traceback.print_exc() |
291 | pass | 284 | pass |
292 | if nextsleep is None and len(self._idlefuns) > 0: | 285 | |
293 | nextsleep = 0 | 286 | socktimeout = self.socket.gettimeout() or nextsleep |
294 | self.timeout = nextsleep | 287 | socktimeout = min(socktimeout, nextsleep) |
288 | # Mirror what BaseServer handle_request would do | ||
289 | fd_sets = select.select(fds, [], [], socktimeout) | ||
290 | if fd_sets[0] and self in fd_sets[0]: | ||
291 | self._handle_request_noblock() | ||
292 | |||
295 | # Tell idle functions we're exiting | 293 | # Tell idle functions we're exiting |
296 | for function, data in self._idlefuns.items(): | 294 | for function, data in self._idlefuns.items(): |
297 | try: | 295 | try: |