Start a fixed number of worker threads and put client into a queue
(self)
| 209 | otrans.close() |
| 210 | |
| 211 | def serve(self): |
| 212 | """Start a fixed number of worker threads and put client into a queue""" |
| 213 | for i in range(self.threads): |
| 214 | try: |
| 215 | t = threading.Thread(target=self.serveThread) |
| 216 | t.daemon = self.daemon |
| 217 | t.start() |
| 218 | except Exception as x: |
| 219 | logger.exception(x) |
| 220 | |
| 221 | # Pump the socket for clients |
| 222 | self.serverTransport.listen() |
| 223 | while True: |
| 224 | try: |
| 225 | client = self.serverTransport.accept() |
| 226 | if not client: |
| 227 | continue |
| 228 | self.clients.put(client) |
| 229 | except Exception as x: |
| 230 | logger.exception(x) |
| 231 | |
| 232 | |
| 233 | class TForkingServer(TServer): |