def update_ping(self): """ Send a keepalive to the client. """ timestamp = timestamp_from_clock(reactor) self.write_packet("ping", pid=timestamp)
def ping(self, container): """ Hook for ping packets. By default, this hook will examine the timestamps on incoming pings, and use them to estimate the current latency of the connected client. """ now = timestamp_from_clock(reactor) then = container.pid self.latency = now - then