Add option for latency control buffer size

This commit resolves #297, allowing the buffers used in the latency control to be changed with a command line option ‘--latency-buffer-size’.

We do this by changing a module variable in ssnet.py (similar to the MAX_CHANNEL variable) which seems to be the simplest code change without extensive hacking.

Documentation is also updated.
This commit is contained in:
Joseph Barker
2019-10-29 09:47:45 +09:00
committed by Brian May
parent c69b9d6f4b
commit 23516ebd71
4 changed files with 23 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import os
from sshuttle.helpers import b, binary_type, log, debug1, debug2, debug3, Fatal
MAX_CHANNEL = 65535
LATENCY_BUFFER_SIZE = 32768
# these don't exist in the socket module in python 2.3!
SHUT_RD = 0
@ -368,7 +369,7 @@ class Mux(Handler):
return total
def check_fullness(self):
if self.fullness > 32768:
if self.fullness > LATENCY_BUFFER_SIZE:
if not self.too_full:
self.send(0, CMD_PING, b('rttest'))
self.too_full = True
@ -448,7 +449,7 @@ class Mux(Handler):
def fill(self):
self.rsock.setblocking(False)
try:
read = _nb_clean(os.read, self.rsock.fileno(), 32768)
read = _nb_clean(os.read, self.rsock.fileno(), LATENCY_BUFFER_SIZE)
except OSError:
_, e = sys.exc_info()[:2]
raise Fatal('other end: %r' % e)