1
This commit is contained in:
parent
d1fab83969
commit
0368ce1295
@ -50,6 +50,8 @@ class ClientSide:
|
|||||||
data = ''
|
data = ''
|
||||||
while True:
|
while True:
|
||||||
data += yield self.remote_conn.read_message()
|
data += yield self.remote_conn.read_message()
|
||||||
|
if not data:
|
||||||
|
continue
|
||||||
lines = data.split('\n')
|
lines = data.split('\n')
|
||||||
if data[-1] == '\n':
|
if data[-1] == '\n':
|
||||||
data = lines[-1]
|
data = lines[-1]
|
||||||
|
@ -50,9 +50,8 @@ class ServerSide:
|
|||||||
self.remoteConnIdx += 1
|
self.remoteConnIdx += 1
|
||||||
self.remotePending[conn.idx] = conn
|
self.remotePending[conn.idx] = conn
|
||||||
conn.localSocket = local_conn
|
conn.localSocket = local_conn
|
||||||
print('zzzzzzzz')
|
|
||||||
self.remotePendingMutex.release()
|
self.remotePendingMutex.release()
|
||||||
local_conn.SendMsg({
|
local_conn.sendMsg({
|
||||||
'remoteConnIdx' : conn.idx,
|
'remoteConnIdx' : conn.idx,
|
||||||
'cmd' : 'connect'
|
'cmd' : 'connect'
|
||||||
})
|
})
|
||||||
@ -92,7 +91,7 @@ class ServerSide:
|
|||||||
try:
|
try:
|
||||||
if len(self.localHandlerHash) <= 0:
|
if len(self.localHandlerHash) <= 0:
|
||||||
return None
|
return None
|
||||||
key = random.choice(list(self.localHanderHash.keys()))
|
key = random.choice(list(self.localHandlerHash.keys()))
|
||||||
return self.localHandlerHash[key]
|
return self.localHandlerHash[key]
|
||||||
finally:
|
finally:
|
||||||
self.localHandlerHashMutex.release()
|
self.localHandlerHashMutex.release()
|
||||||
@ -159,8 +158,8 @@ class RemoteServer(tornado.tcpserver.TCPServer):
|
|||||||
if not app.addRemoteConn(conn):
|
if not app.addRemoteConn(conn):
|
||||||
stream.close()
|
stream.close()
|
||||||
return
|
return
|
||||||
await gen.sleep(2)
|
await tornado.gen.sleep(2)
|
||||||
if not app.isConnectOk(conn.connIdx):
|
if not app.isConnectOk(conn.idx):
|
||||||
stream.close()
|
stream.close()
|
||||||
return
|
return
|
||||||
await conn.handle_stream()
|
await conn.handle_stream()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user