()
| 321 | logging.info(f"Client#{clientID} released all thread resources") |
| 322 | |
| 323 | |
| 324 | def main(): |
| 325 | config = load_runtime_config() |
| 326 | |
| 327 | listenIp = config['ClientConfig']['proxyIp_'] |
| 328 | listenPort = config['ClientConfig']['proxyPort_'] |
| 329 | |
| 330 | |
| 331 | |
| 332 | listen_proxy = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 333 | listen_proxy.bind((listenIp, listenPort)) |
| 334 | listen_proxy.listen() |
| 335 | logging.info(f"Listening on {listenIp}:{listenPort}") |
| 336 | |
| 337 | try: |
| 338 | while True: |
| 339 | conn, addr = listen_proxy.accept() |
| 340 | logging.debug(f"Accepted connection from {addr}") |
| 341 | threading.Thread(target=handle_client_worker, args=(conn, addr)).start() |
| 342 | except KeyboardInterrupt: |
| 343 | logging.info("Shutting down...") |
| 344 | listen_proxy.close() |
| 345 | |
| 346 | |
| 347 | if __name__ == "__main__": |
| 348 | main() |
no test coverage detected