Wait handshake done before sending other request to connections
This commit is contained in:
parent
81d50ed3bb
commit
5887f90202
1 changed files with 5 additions and 1 deletions
|
@ -475,6 +475,10 @@ class Connection(object):
|
||||||
self.log("Send error: missing socket")
|
self.log("Send error: missing socket")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if not self.connected and message.get("cmd") != "handshake":
|
||||||
|
self.log("Wait for handshake before send request")
|
||||||
|
self.event_connected.get()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stat_key = message.get("cmd", "unknown")
|
stat_key = message.get("cmd", "unknown")
|
||||||
if stat_key == "response":
|
if stat_key == "response":
|
||||||
|
@ -499,7 +503,7 @@ class Connection(object):
|
||||||
with self.send_lock:
|
with self.send_lock:
|
||||||
self.sock.sendall(data)
|
self.sock.sendall(data)
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
self.close("Send error: %s" % err)
|
self.close("Send error: %s (cmd: %s)" % (err, stat_key))
|
||||||
return False
|
return False
|
||||||
self.last_sent_time = time.time()
|
self.last_sent_time = time.time()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue