diff --git a/scripts/proxy/cliside.py b/scripts/proxy/cliside.py index 7bfe50b..9b0ed09 100644 --- a/scripts/proxy/cliside.py +++ b/scripts/proxy/cliside.py @@ -50,6 +50,8 @@ class ClientSide: data = '' while True: data += yield self.remote_conn.read_message() + if not data: + continue lines = data.split('\n') if data[-1] == '\n': data = lines[-1] diff --git a/scripts/proxy/srvside.py b/scripts/proxy/srvside.py index 55d35fb..49dda5e 100644 --- a/scripts/proxy/srvside.py +++ b/scripts/proxy/srvside.py @@ -50,9 +50,8 @@ class ServerSide: self.remoteConnIdx += 1 self.remotePending[conn.idx] = conn conn.localSocket = local_conn - print('zzzzzzzz') self.remotePendingMutex.release() - local_conn.SendMsg({ + local_conn.sendMsg({ 'remoteConnIdx' : conn.idx, 'cmd' : 'connect' }) @@ -92,7 +91,7 @@ class ServerSide: try: if len(self.localHandlerHash) <= 0: return None - key = random.choice(list(self.localHanderHash.keys())) + key = random.choice(list(self.localHandlerHash.keys())) return self.localHandlerHash[key] finally: self.localHandlerHashMutex.release() @@ -159,8 +158,8 @@ class RemoteServer(tornado.tcpserver.TCPServer): if not app.addRemoteConn(conn): stream.close() return - await gen.sleep(2) - if not app.isConnectOk(conn.connIdx): + await tornado.gen.sleep(2) + if not app.isConnectOk(conn.idx): stream.close() return await conn.handle_stream()