b.t.s.SocketDelay(object) : class documentation

Part of bzrlib.tests.stub_sftp View In Hierarchy

A socket decorator to make TCP appear slower.

This changes recv, send, and sendall to add a fixed latency to each python call if a new roundtrip is detected. That is, when a recv is called and the flag new_roundtrip is set, latency is charged. Every send and send_all sets this flag.

In addition every send, sendall and recv sleeps a bit per character send to simulate bandwidth.

Not all methods are implemented, this is deliberate as this class is not a replacement for the builtin sockets layer. fileno is not implemented to prevent the proxy being bypassed.

Method __init__
Method sleep Undocumented
Method __getattr__ Undocumented
Method dup Undocumented
Method recv Undocumented
Method sendall Undocumented
Method send Undocumented
def __init__(self, sock, latency, bandwidth=1.0, really_sleep=True):
:param bandwith: simulated bandwith (MegaBit)
:param really_sleep: If set to false, the SocketDelay will just
increase a counter, instead of calling time.sleep. This is useful for
unittesting the SocketDelay.
def sleep(self, s):
Undocumented
def __getattr__(self, attr):
Undocumented
def dup(self):
Undocumented
def recv(self, *args):
Undocumented
def sendall(self, data, flags=0):
Undocumented
def send(self, data, flags=0):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2021-10-15 00:19:52.