diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 1e4b51e35e..28b8eb9b86 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -130,6 +130,7 @@ class ProcessServer(multiprocessing.Process): | |||
130 | bb.utils.set_process_name("Cooker") | 130 | bb.utils.set_process_name("Cooker") |
131 | 131 | ||
132 | ready = [] | 132 | ready = [] |
133 | newconnections = [] | ||
133 | 134 | ||
134 | self.controllersock = False | 135 | self.controllersock = False |
135 | fds = [self.sock] | 136 | fds = [self.sock] |
@@ -138,37 +139,48 @@ class ProcessServer(multiprocessing.Process): | |||
138 | print("Entering server connection loop") | 139 | print("Entering server connection loop") |
139 | 140 | ||
140 | def disconnect_client(self, fds): | 141 | def disconnect_client(self, fds): |
141 | if not self.haveui: | ||
142 | return | ||
143 | print("Disconnecting Client") | 142 | print("Disconnecting Client") |
144 | fds.remove(self.controllersock) | 143 | if self.controllersock: |
145 | fds.remove(self.command_channel) | 144 | fds.remove(self.controllersock) |
146 | bb.event.unregister_UIHhandler(self.event_handle, True) | 145 | self.controllersock.close() |
147 | self.command_channel_reply.writer.close() | 146 | self.controllersock = False |
148 | self.event_writer.writer.close() | 147 | if self.haveui: |
149 | del self.event_writer | 148 | fds.remove(self.command_channel) |
150 | self.controllersock.close() | 149 | bb.event.unregister_UIHhandler(self.event_handle, True) |
151 | self.controllersock = False | 150 | self.command_channel_reply.writer.close() |
152 | self.haveui = False | 151 | self.event_writer.writer.close() |
153 | self.lastui = time.time() | 152 | self.command_channel.close() |
154 | self.cooker.clientComplete() | 153 | self.command_channel = False |
155 | if self.timeout is None: | 154 | del self.event_writer |
155 | self.lastui = time.time() | ||
156 | self.cooker.clientComplete() | ||
157 | self.haveui = False | ||
158 | ready = select.select(fds,[],[],0)[0] | ||
159 | if newconnections: | ||
160 | print("Starting new client") | ||
161 | conn = newconnections.pop(-1) | ||
162 | fds.append(conn) | ||
163 | self.controllersock = conn | ||
164 | elif self.timeout is None and not ready: | ||
156 | print("No timeout, exiting.") | 165 | print("No timeout, exiting.") |
157 | self.quit = True | 166 | self.quit = True |
158 | 167 | ||
159 | while not self.quit: | 168 | while not self.quit: |
160 | if self.sock in ready: | 169 | if self.sock in ready: |
161 | self.controllersock, address = self.sock.accept() | 170 | while select.select([self.sock],[],[],0)[0]: |
162 | if self.haveui: | 171 | controllersock, address = self.sock.accept() |
163 | print("Dropping connection attempt as we have a UI %s" % (str(ready))) | 172 | if self.controllersock: |
164 | self.controllersock.close() | 173 | print("Queuing %s (%s)" % (str(ready), str(newconnections))) |
165 | else: | 174 | newconnections.append(controllersock) |
166 | print("Accepting %s" % (str(ready))) | 175 | else: |
167 | fds.append(self.controllersock) | 176 | print("Accepting %s (%s)" % (str(ready), str(newconnections))) |
177 | self.controllersock = controllersock | ||
178 | fds.append(controllersock) | ||
168 | if self.controllersock in ready: | 179 | if self.controllersock in ready: |
169 | try: | 180 | try: |
170 | print("Connecting Client") | 181 | print("Processing Client") |
171 | ui_fds = recvfds(self.controllersock, 3) | 182 | ui_fds = recvfds(self.controllersock, 3) |
183 | print("Connecting Client") | ||
172 | 184 | ||
173 | # Where to write events to | 185 | # Where to write events to |
174 | writer = ConnectionWriter(ui_fds[0]) | 186 | writer = ConnectionWriter(ui_fds[0]) |