From 8f2ea028ae500206b425596d9b64967aea022443 Mon Sep 17 00:00:00 2001 From: Sandip Pandey Date: Mon, 5 Feb 2024 12:43:59 +0100 Subject: [PATCH] Add SOCKS5 ports to sentry reporter --- .../core/components/socks_servers/socks_servers_component.py | 4 ++++ .../socks_servers/tests/test_socks_servers_component.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tribler/core/components/socks_servers/socks_servers_component.py b/src/tribler/core/components/socks_servers/socks_servers_component.py index 7ee91cccce2..a736750e5a3 100644 --- a/src/tribler/core/components/socks_servers/socks_servers_component.py +++ b/src/tribler/core/components/socks_servers/socks_servers_component.py @@ -6,6 +6,7 @@ from tribler.core.utilities.network_utils import default_network_utils NUM_SOCKS_PROXIES = 5 +SOCKS5_SERVER_PORTS = 'socks5_server_ports' class SocksServersComponent(Component): @@ -31,6 +32,9 @@ async def run(self): self.logger.info(f'Socks listen port: {self.socks_ports}') + # Set the SOCKS5 server ports in the reporter for debugging Network errors + self.reporter.additional_information[SOCKS5_SERVER_PORTS] = self.socks_ports + async def shutdown(self): for socks_server in self.socks_servers: await socks_server.stop() diff --git a/src/tribler/core/components/socks_servers/tests/test_socks_servers_component.py b/src/tribler/core/components/socks_servers/tests/test_socks_servers_component.py index 0ac3e2025ed..443f60fa382 100644 --- a/src/tribler/core/components/socks_servers/tests/test_socks_servers_component.py +++ b/src/tribler/core/components/socks_servers/tests/test_socks_servers_component.py @@ -1,5 +1,5 @@ from tribler.core.components.session import Session -from tribler.core.components.socks_servers.socks_servers_component import SocksServersComponent +from tribler.core.components.socks_servers.socks_servers_component import SocksServersComponent, SOCKS5_SERVER_PORTS # pylint: disable=protected-access @@ -10,3 +10,4 @@ async def test_socks_servers_component(tribler_config): assert comp.started_event.is_set() and not comp.failed assert comp.socks_ports assert comp.socks_servers + assert comp.reporter.additional_information[SOCKS5_SERVER_PORTS] == comp.socks_ports