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

Fixed anon download test not waiting for port #8144

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

qstokkink
Copy link
Contributor

@qstokkink qstokkink commented Sep 6, 2024

Fixes #8143

This PR:

  • Fixes start_anon_download not waiting for listen_ports to be created.

Validated fix with:

diff --git a/src/tribler/core/libtorrent/download_manager/download_manager.py b/src/tribler/core/libtorrent/download_manager/download_manager.py
index 6346306eb..4d71bc241 100644
--- a/src/tribler/core/libtorrent/download_manager/download_manager.py
+++ b/src/tribler/core/libtorrent/download_manager/download_manager.py
@@ -475,7 +475,10 @@ class DownloadManager(TaskManager):
 
         if alert_type == "listen_succeeded_alert":
             ls_alert = cast(lt.listen_succeeded_alert, alert)
-            self.listen_ports[hops][ls_alert.address] = ls_alert.port
+            def do_later(address, port):
+                self.listen_ports[hops][address] = port
+            self.register_anonymous_task("later", do_later, ls_alert.address, ls_alert.port, delay=3)
+            #self.listen_ports[hops][ls_alert.address] = ls_alert.port
 
         elif alert_type == "peer_disconnected_alert":
             self.notifier.notify(Notification.peer_disconnected,

@qstokkink qstokkink force-pushed the fix_anon_listen_test branch from d4e7d7c to 23db3b3 Compare September 6, 2024 13:47
@qstokkink qstokkink changed the title WIP: Fixed anon download test not waiting for port READY: Fixed anon download test not waiting for port Sep 6, 2024
@qstokkink qstokkink marked this pull request as ready for review September 6, 2024 13:53
@qstokkink qstokkink changed the title READY: Fixed anon download test not waiting for port Fixed anon download test not waiting for port Sep 6, 2024
@qstokkink qstokkink merged commit 4c389cc into Tribler:main Sep 6, 2024
7 checks passed
@qstokkink qstokkink deleted the fix_anon_listen_test branch September 6, 2024 14:00
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.

test_anon_download failure Windows, 3.9
2 participants