Auto-set sensible interface rate defaults

This commit is contained in:
Mark Qvist 2022-04-17 19:35:31 +02:00
parent dd55899775
commit 124ec006b4
5 changed files with 44 additions and 0 deletions

View file

@ -210,6 +210,7 @@ class I2PInterfacePeer(Interface):
self.i2p_dest = None
self.i2p_tunnel_ready = False
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL
self.bitrate = I2PInterface.BITRATE_GUESS
if max_reconnect_tries == None:
self.max_reconnect_tries = I2PInterfacePeer.RECONNECT_MAX_TRIES
@ -523,6 +524,7 @@ class I2PInterfacePeer(Interface):
class I2PInterface(Interface):
BITRATE_GUESS = 256*1000
def __init__(self, owner, name, rns_storagepath, peers, connectable = True):
self.rxb = 0
@ -546,6 +548,7 @@ class I2PInterface(Interface):
self.bind_ip = "127.0.0.1"
self.bind_port = self.i2p.get_free_port()
self.address = (self.bind_ip, self.bind_port)
self.bitrate = I2PInterface.BITRATE_GUESS
i2p_thread = threading.Thread(target=self.i2p.start)
i2p_thread.setDaemon(True)