gale.net.peer module

This file contains the implementation of the class Peer, the Server-side handle to a connected Client.

Author: Alejandro Mujica (aledrums@gmail.com)

class gale.net.peer.Peer(peer_id, address, token)[source]

Bases: object

Represents one connected client, from the Server’s point of view.

Usage example:

for peer in server.get_peers():

print(peer.peer_id, peer.address, peer.rtt)

Parameters:
  • peer_id (int)

  • address (Tuple[str, int])

  • token (int)

update_rtt(sample)[source]

Fold a new round-trip-time sample into the smoothed estimate using an exponential moving average.

Parameters:

sample (float) – The latest measured round-trip time, in seconds.

Return type:

None