MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / ping

Method ping

src/Connection/Connection.py:591–603  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

589 return res
590
591 def ping(self):
592 s = time.time()
593 response = None
594 with gevent.Timeout(10.0, False):
595 try:
596 response = self.request("ping")
597 except Exception as err:
598 self.log("Ping error: %s" % Debug.formatException(err))
599 if response and "body" in response and response["body"] == b"Pong!":
600 self.last_ping_delay = time.time() - s
601 return True
602 else:
603 return False
604
605 # Close connection
606 def close(self, reason="Unknown"):

Callers 1

checkConnectionsMethod · 0.45

Calls 2

requestMethod · 0.95
logMethod · 0.95

Tested by

no test coverage detected