From 13b4291840bba5f370169312d7eabb09053f32f2 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 8 Apr 2025 02:33:32 +0200 Subject: [PATCH] Epoll backend switch --- RNS/Interfaces/Interface.py | 4 +++- RNS/Interfaces/LocalInterface.py | 6 +++--- RNS/vendor/platformutils.py | 4 ++++ tests/rnsconfig/config | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/RNS/Interfaces/Interface.py b/RNS/Interfaces/Interface.py index a28c98c..9918ea2 100755 --- a/RNS/Interfaces/Interface.py +++ b/RNS/Interfaces/Interface.py @@ -127,7 +127,9 @@ class Interface: def optimise_mtu(self): if self.AUTOCONFIGURE_MTU: - if self.bitrate > 16_000_000: + if self.bitrate > 500_000_000: + self.HW_MTU = 1048576 + elif self.bitrate > 16_000_000: self.HW_MTU = 262144 elif self.bitrate > 8_000_000: self.HW_MTU = 131072 diff --git a/RNS/Interfaces/LocalInterface.py b/RNS/Interfaces/LocalInterface.py index d732269..9f58951 100644 --- a/RNS/Interfaces/LocalInterface.py +++ b/RNS/Interfaces/LocalInterface.py @@ -62,7 +62,7 @@ class LocalClientInterface(Interface): self.HW_MTU = 262144 self.online = False - if socket_path != None and RNS.vendor.platformutils.is_linux(): self.socket_path = f"\0rns/{socket_path}" + if socket_path != None and RNS.vendor.platformutils.use_epoll(): self.socket_path = f"\0rns/{socket_path}" else: self.socket_path = None self.IN = True @@ -77,7 +77,7 @@ class LocalClientInterface(Interface): self.frame_buffer = b"" self.transmit_buffer = b"" - if RNS.vendor.platformutils.is_linux(): + if RNS.vendor.platformutils.use_epoll(): self.epoll_backend = True if connected_socket != None: @@ -349,7 +349,7 @@ class LocalServerInterface(Interface): self.name = "Reticulum" self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL - if RNS.vendor.platformutils.is_linux(): + if RNS.vendor.platformutils.use_epoll(): self.epoll_backend = True if socket_path != None and self.epoll_backend: diff --git a/RNS/vendor/platformutils.py b/RNS/vendor/platformutils.py index 0246307..ce9e072 100644 --- a/RNS/vendor/platformutils.py +++ b/RNS/vendor/platformutils.py @@ -32,6 +32,10 @@ def is_windows(): else: return False +def use_epoll(): + if is_linux(): return True + else: return False + def platform_checks(): if is_windows(): import sys diff --git a/tests/rnsconfig/config b/tests/rnsconfig/config index 20001f9..10e2dea 100644 --- a/tests/rnsconfig/config +++ b/tests/rnsconfig/config @@ -1,6 +1,7 @@ [reticulum] enable_transport = no share_instance = Yes + instance_name = testrunner shared_instance_port = 55905 instance_control_port = 55906 panic_on_interface_error = No