Only count ping time if no waiting requests
This commit is contained in:
parent
a2eef70030
commit
461f0a274a
1 changed files with 2 additions and 2 deletions
|
@ -237,7 +237,7 @@ class Connection(object):
|
||||||
self.last_message_time = time.time()
|
self.last_message_time = time.time()
|
||||||
if message.get("cmd") == "response": # New style response
|
if message.get("cmd") == "response": # New style response
|
||||||
if message["to"] in self.waiting_requests:
|
if message["to"] in self.waiting_requests:
|
||||||
if self.last_send_time:
|
if self.last_send_time and len(self.waiting_requests) == 1:
|
||||||
ping = time.time() - self.last_send_time
|
ping = time.time() - self.last_send_time
|
||||||
self.last_ping_delay = ping
|
self.last_ping_delay = ping
|
||||||
self.waiting_requests[message["to"]].set(message) # Set the response to event
|
self.waiting_requests[message["to"]].set(message) # Set the response to event
|
||||||
|
@ -251,7 +251,7 @@ class Connection(object):
|
||||||
if message.get("crypt") and not self.sock_wrapped:
|
if message.get("crypt") and not self.sock_wrapped:
|
||||||
self.crypt = message["crypt"]
|
self.crypt = message["crypt"]
|
||||||
server = (self.type == "in")
|
server = (self.type == "in")
|
||||||
self.log("Crypt out connection using: %s (server side: %s)..." % (self.crypt, server))
|
self.log("Crypt out connection using: %s (server side: %s, ping: %.3fs)..." % (self.crypt, server, ping))
|
||||||
self.sock = CryptConnection.manager.wrapSocket(self.sock, self.crypt, server, cert_pin=self.cert_pin)
|
self.sock = CryptConnection.manager.wrapSocket(self.sock, self.crypt, server, cert_pin=self.cert_pin)
|
||||||
self.sock.do_handshake()
|
self.sock.do_handshake()
|
||||||
self.sock_wrapped = True
|
self.sock_wrapped = True
|
||||||
|
|
Loading…
Reference in a new issue