Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #49 from qstokkink/fix_trnsrcv_callargs
Browse files Browse the repository at this point in the history
Fixed wrong UdpSocketManager.transport_received signature as callback
  • Loading branch information
qstokkink authored May 15, 2024
2 parents ba7123b + 98b2d43 commit 86060b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tribler/core/torrent_checker/torrentchecker_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from tribler.core.torrent_checker.dataclasses import HealthInfo, TrackerResponse

if TYPE_CHECKING:
from ipv8.messaging.interfaces.udp.endpoint import DomainAddress

from tribler.core.libtorrent.download_manager import DownloadManager

# Although these are the actions for UDP trackers, they can still be used as
Expand Down Expand Up @@ -234,7 +236,7 @@ async def send_request(self, data: bytes, tracker_session: UdpTrackerSession) ->
proxy = tracker_session.proxy

if proxy:
transport = self.proxy_transports.get(proxy, Socks5Client(proxy, self.transport_received))
transport = self.proxy_transports.get(proxy, Socks5Client(proxy, self.datagram_received))
if not transport.associated:
await transport.associate_udp()
if proxy not in self.proxy_transports:
Expand Down Expand Up @@ -264,7 +266,7 @@ def transport_received(self, data: bytes) -> None:
if not session.done():
session.set_result(data)

def datagram_received(self, data: bytes, _: tuple[str, int]) -> None:
def datagram_received(self, data: bytes, _: DomainAddress | tuple[str, int]) -> None:
"""
If the incoming data is valid, find the tracker session and give it the data.
"""
Expand Down

0 comments on commit 86060b7

Please sign in to comment.