|
@@ -1,6 +1,6 @@
|
|
"""
|
|
"""
|
|
"""
|
|
"""
|
|
-# from hub import methods, Global
|
|
|
|
|
|
+from hub import methods, Global, protobuf
|
|
|
|
|
|
from werkzeug.security import check_password_hash
|
|
from werkzeug.security import check_password_hash
|
|
import struct
|
|
import struct
|
|
@@ -8,21 +8,6 @@ import asyncio
|
|
import time
|
|
import time
|
|
import socket
|
|
import socket
|
|
|
|
|
|
-import sys
|
|
|
|
-import importlib
|
|
|
|
-
|
|
|
|
-# --- for linux
|
|
|
|
-# sys.path.append('/home/sri/repositories/repositories/SRI-DINO.Server-py/sri-server-bg03')
|
|
|
|
-# sys.path.append('/home/sri/repositories/repositories/SRI-DINO.Server-py/sri-pysdk')
|
|
|
|
-
|
|
|
|
-# --- for windows
|
|
|
|
-sys.path.append(r'C:\SRI-DINO.Server-py\sri-server-bg03')
|
|
|
|
-sys.path.append(r'C:\SRI-DINO.Server-py\sri-pysdk')
|
|
|
|
-
|
|
|
|
-protobuf = importlib.import_module(f"xprotobuf.protocol_pb2")
|
|
|
|
-methods = importlib.import_module(f"xlib")
|
|
|
|
-mdb = importlib.import_module(f"xclient.xmongo").Client(host='127.0.0.1', port=47017, database='bg',
|
|
|
|
- username='admin', password='admin')
|
|
|
|
clients = {} # {<ipv4>: (socket, update_at, type)} | {<连接id>: (socket对象, 最后一次请求时间, 客户端类型)}
|
|
clients = {} # {<ipv4>: (socket, update_at, type)} | {<连接id>: (socket对象, 最后一次请求时间, 客户端类型)}
|
|
serial_rid_dict = {
|
|
serial_rid_dict = {
|
|
'65F7171A-5585-46C7-A9D6-967ABA9EB223': 1000000,
|
|
'65F7171A-5585-46C7-A9D6-967ABA9EB223': 1000000,
|
|
@@ -290,7 +275,7 @@ class SRIConnection(asyncio.Protocol):
|
|
ret = False
|
|
ret = False
|
|
|
|
|
|
# --- check ---
|
|
# --- check ---
|
|
- user = mdb.get_one('UserInfo', {'username': object.account})
|
|
|
|
|
|
+ user = Global.mdb.get_one('UserInfo', {'username': object.account})
|
|
name = ''
|
|
name = ''
|
|
uuid = ''
|
|
uuid = ''
|
|
if not user:
|
|
if not user:
|
|
@@ -666,12 +651,12 @@ class SRIConnection(asyncio.Protocol):
|
|
loop = asyncio.get_running_loop()
|
|
loop = asyncio.get_running_loop()
|
|
server = await loop.create_server(
|
|
server = await loop.create_server(
|
|
lambda: SRIConnection(),
|
|
lambda: SRIConnection(),
|
|
- '0.0.0.0', 20917
|
|
|
|
|
|
+ '0.0.0.0', Global.egoserver_port
|
|
)
|
|
)
|
|
|
|
|
|
# --- start ---
|
|
# --- start ---
|
|
async with server:
|
|
async with server:
|
|
- print("Server listening on 0.0.0.0:20917", flush=True)
|
|
|
|
|
|
+ print(f"Server listening on 0.0.0.0:{Global.egoserver_port}", flush=True)
|
|
# await loop.create_task(SRIConnection.check_clients())
|
|
# await loop.create_task(SRIConnection.check_clients())
|
|
await server.serve_forever()
|
|
await server.serve_forever()
|
|
|
|
|