Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The get_circuit_slots method of DebugEndpoint should handle the case when tunnel_community is None #7504

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

kozlovsky
Copy link
Contributor

The run method of RESTComponent has the following lines:

torrent_checker = None if config.gui_test_mode else torrent_checker_component.torrent_checker
tunnel_community = None if config.gui_test_mode else tunnel_component.community
gigachannel_manager = None if config.gui_test_mode else gigachannel_manager_component.gigachannel_manager

That is, tunnel_community is None when Tribler is started for GUI tests.

At the same time, the DebugEndpoint in the RESTComponent.run method is initialized in the following way:

self.maybe_add('/debug', DebugEndpoint, config.state_dir, log_dir,
               tunnel_community=tunnel_community,
               resource_monitor=resource_monitor_component.resource_monitor,
               core_exception_handler=self._core_exception_handler)

Here, tunnel_community is passed as None when Tribler is in gui_test_mode.

The maybe_add method does not affect this situation, as it only handles special NoneComponent arguments and not normal None values.

Therefore, the code of DebugEndpoint should expect to handle the situation gracefully when the tunnel_community is None. But in the get_circuit_slots method, it currently expects a non-None instance of tunnel_community.

This PR fixes the problem by handling the case when self.tunnel_community is None in DebugEndpoint

@kozlovsky kozlovsky requested review from a team and xoriole and removed request for a team June 26, 2023 12:27
@kozlovsky kozlovsky changed the title Fix get circuit slots The get_circuit_slots method of DebugEndpoint should handle the case when tunnel_community is None Jun 26, 2023
@drew2a
Copy link
Contributor

drew2a commented Jun 26, 2023

Related to #7495

@kozlovsky kozlovsky merged commit 4a4b04d into Tribler:release/7.13 Jun 26, 2023
16 checks passed
@kozlovsky kozlovsky deleted the fix/get_circuit_slots branch June 26, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants