diff options
| author | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-08 22:43:18 +0100 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-08 22:43:18 +0100 |
| commit | 67d169aa1ce9ce435989e1416b94f64652b1883d (patch) | |
| tree | cf732925f711141be34a5f5e857e7155c5abaa7d /bitbake-dev/lib/bb/xmlrpcserver.py | |
| parent | 41ff874c7fbd9c2ce6e15d4e4744015cd62d43b7 (diff) | |
| download | poky-67d169aa1ce9ce435989e1416b94f64652b1883d.tar.gz | |
bitbake-dev: Fix to work with python 2.6 by dropping the now uneeded get_request overloaded function and using timeouts instead
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake-dev/lib/bb/xmlrpcserver.py')
| -rw-r--r-- | bitbake-dev/lib/bb/xmlrpcserver.py | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/bitbake-dev/lib/bb/xmlrpcserver.py b/bitbake-dev/lib/bb/xmlrpcserver.py index 2a23436b65..557f69c996 100644 --- a/bitbake-dev/lib/bb/xmlrpcserver.py +++ b/bitbake-dev/lib/bb/xmlrpcserver.py | |||
| @@ -115,7 +115,24 @@ class BitBakeXMLRPCServer(SimpleXMLRPCServer): | |||
| 115 | """ | 115 | """ |
| 116 | self.quit = False | 116 | self.quit = False |
| 117 | while not self.quit: | 117 | while not self.quit: |
| 118 | print "Idle queue length %s" % len(self._idlefuns) | ||
| 119 | if len(self._idlefuns) == 0: | ||
| 120 | self.timeout = None | ||
| 121 | else: | ||
| 122 | self.timeout = 0 | ||
| 118 | self.handle_request() | 123 | self.handle_request() |
| 124 | print "Idle timeout, running idle functions" | ||
| 125 | for function, data in self._idlefuns.items(): | ||
| 126 | try: | ||
| 127 | retval = function(self, data, False) | ||
| 128 | if not retval: | ||
| 129 | del self._idlefuns[function] | ||
| 130 | except SystemExit: | ||
| 131 | raise | ||
| 132 | except: | ||
| 133 | import traceback | ||
| 134 | traceback.print_exc() | ||
| 135 | pass | ||
| 119 | 136 | ||
| 120 | # Tell idle functions we're exiting | 137 | # Tell idle functions we're exiting |
| 121 | for function, data in self._idlefuns.items(): | 138 | for function, data in self._idlefuns.items(): |
| @@ -126,32 +143,3 @@ class BitBakeXMLRPCServer(SimpleXMLRPCServer): | |||
| 126 | 143 | ||
| 127 | self.server_close() | 144 | self.server_close() |
| 128 | return | 145 | return |
| 129 | |||
| 130 | def get_request(self): | ||
| 131 | """ | ||
| 132 | Get next request. Behaves like the parent class unless a waitpid callback | ||
| 133 | has been set. In that case, we regularly check waitpid when the server is idle | ||
| 134 | """ | ||
| 135 | while True: | ||
| 136 | # wait 500 ms for an xmlrpc request | ||
| 137 | if DEBUG: | ||
| 138 | print "DEBUG: select'ing 500ms waiting for an xmlrpc request..." | ||
| 139 | ifds, ofds, xfds = select.select([self.socket.fileno()], [], [], 0.5) | ||
| 140 | if ifds: | ||
| 141 | return self.socket.accept() | ||
| 142 | # call idle functions only if we're not shutting down atm to prevent a recursion | ||
| 143 | if not self.quit: | ||
| 144 | if DEBUG: | ||
| 145 | print "DEBUG: server is idle -- calling idle functions..." | ||
| 146 | for function, data in self._idlefuns.items(): | ||
| 147 | try: | ||
| 148 | retval = function(self, data, False) | ||
| 149 | if not retval: | ||
| 150 | del self._idlefuns[function] | ||
| 151 | except SystemExit: | ||
| 152 | raise | ||
| 153 | except: | ||
| 154 | import traceback | ||
| 155 | traceback.print_exc() | ||
| 156 | pass | ||
| 157 | |||
