|
@@ -715,19 +715,28 @@ class SRIConnection(asyncio.Protocol):
|
|
|
async def run():
|
|
|
"""
|
|
|
"""
|
|
|
- # --- define ---
|
|
|
- loop = asyncio.get_running_loop()
|
|
|
- server = await loop.create_server(
|
|
|
- lambda: SRIConnection(),
|
|
|
- '0.0.0.0', Global.egoserver_port
|
|
|
- )
|
|
|
-
|
|
|
- # --- start ---
|
|
|
- async with server:
|
|
|
- print(f"Connection_e1:713|Server listening on 0.0.0.0:{Global.egoserver_port}", flush=True)
|
|
|
- # await loop.create_task(Connection_e1:.check_clients())
|
|
|
- await server.serve_forever()
|
|
|
+ while True:
|
|
|
|
|
|
+ try:
|
|
|
+ # --- define ---
|
|
|
+ loop = asyncio.get_running_loop()
|
|
|
+ server = await loop.create_server(
|
|
|
+ lambda: SRIConnection(),
|
|
|
+ '0.0.0.0', Global.egoserver_port
|
|
|
+ )
|
|
|
+
|
|
|
+ # --- start ---
|
|
|
+ async with server:
|
|
|
+ print(f"Connection_e1:713|Server listening on 0.0.0.0:{Global.egoserver_port}", flush=True)
|
|
|
+ # await loop.create_task(Connection_e1:.check_clients())
|
|
|
+ await server.serve_forever()
|
|
|
+
|
|
|
+ except Exception as exception:
|
|
|
+
|
|
|
+ methods.debug_log("Connection_e1:735", f"exception: {exception.__class__.__name__}")
|
|
|
+ methods.debug_log("Connection_e1:735", f"traceback: {traceback.format_exc()}")
|
|
|
+ methods.debug_log('Connection_e1:735', f"wait 10s try again!")
|
|
|
+ time.sleep(10)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
asyncio.run(SRIConnection.run())
|