diff options
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
| -rw-r--r-- | bitbake/lib/bb/server/process.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index ee8b14ea7d..a7a6fbff69 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
| @@ -134,6 +134,26 @@ class ProcessServer(multiprocessing.Process): | |||
| 134 | if self.xmlrpc: | 134 | if self.xmlrpc: |
| 135 | fds.append(self.xmlrpc) | 135 | fds.append(self.xmlrpc) |
| 136 | print("Entering server connection loop") | 136 | print("Entering server connection loop") |
| 137 | |||
| 138 | def disconnect_client(self, fds): | ||
| 139 | if not self.haveui: | ||
| 140 | return | ||
| 141 | print("Disconnecting Client") | ||
| 142 | fds.remove(self.controllersock) | ||
| 143 | fds.remove(self.command_channel) | ||
| 144 | bb.event.unregister_UIHhandler(self.event_handle, True) | ||
| 145 | self.command_channel_reply.writer.close() | ||
| 146 | self.event_writer.writer.close() | ||
| 147 | del self.event_writer | ||
| 148 | self.controllersock.close() | ||
| 149 | self.controllersock = False | ||
| 150 | self.haveui = False | ||
| 151 | self.lastui = time.time() | ||
| 152 | self.cooker.clientComplete() | ||
| 153 | if self.timeout is None: | ||
| 154 | print("No timeout, exiting.") | ||
| 155 | self.quit = True | ||
| 156 | |||
| 137 | while not self.quit: | 157 | while not self.quit: |
| 138 | if self.sock in ready: | 158 | if self.sock in ready: |
| 139 | self.controllersock, address = self.sock.accept() | 159 | self.controllersock, address = self.sock.accept() |
| @@ -165,21 +185,8 @@ class ProcessServer(multiprocessing.Process): | |||
| 165 | self.haveui = True | 185 | self.haveui = True |
| 166 | 186 | ||
| 167 | except (EOFError, OSError): | 187 | except (EOFError, OSError): |
| 168 | print("Disconnecting Client") | 188 | disconnect_client(self, fds) |
| 169 | fds.remove(self.controllersock) | 189 | |
| 170 | fds.remove(self.command_channel) | ||
| 171 | bb.event.unregister_UIHhandler(self.event_handle, True) | ||
| 172 | self.command_channel_reply.writer.close() | ||
| 173 | self.event_writer.writer.close() | ||
| 174 | del self.event_writer | ||
| 175 | self.controllersock.close() | ||
| 176 | self.controllersock = False | ||
| 177 | self.haveui = False | ||
| 178 | self.lastui = time.time() | ||
| 179 | self.cooker.clientComplete() | ||
| 180 | if self.timeout is None: | ||
| 181 | print("No timeout, exiting.") | ||
| 182 | self.quit = True | ||
| 183 | if not self.timeout == -1.0 and not self.haveui and self.lastui and self.timeout and \ | 190 | if not self.timeout == -1.0 and not self.haveui and self.lastui and self.timeout and \ |
| 184 | (self.lastui + self.timeout) < time.time(): | 191 | (self.lastui + self.timeout) < time.time(): |
| 185 | print("Server timeout, exiting.") | 192 | print("Server timeout, exiting.") |
| @@ -191,6 +198,7 @@ class ProcessServer(multiprocessing.Process): | |||
| 191 | except EOFError: | 198 | except EOFError: |
| 192 | # Client connection shutting down | 199 | # Client connection shutting down |
| 193 | ready = [] | 200 | ready = [] |
| 201 | disconnect_client(self, fds) | ||
| 194 | continue | 202 | continue |
| 195 | if command[0] == "terminateServer": | 203 | if command[0] == "terminateServer": |
| 196 | self.quit = True | 204 | self.quit = True |
