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

MonoTorrent.Dht.MessageLoop.ReceiveMessage doesn't appear to react to fresh queries from others #699

Open
miniksa opened this issue Sep 18, 2024 · 0 comments

Comments

@miniksa
Copy link

miniksa commented Sep 18, 2024

I've been playing around with MonoTorrent this week to figure out and explore various BitTorrent functionality for some of my existing C# tooling.

However, I'm experiencing a headache when it comes to the DhtEngine.

I can stand up one instance of the MonoTorrent DhtEngine listening on one port and an another on another port on the same machine.

I tell instance A that a peer is available on instance B by loading it in during engine.StartAsync. And I walk through under a debugger and observe Instance A will send the UDP FindNode message correctly. I can also breakpoint inside Instance B and watch it receive the FindNode message and head into MessageLoop.ReceiveMessage.

However, inside that method, it looks like it does the following:

  1. Update its routing table with the peer it heard from
  2. Handle a response or error message
  3. Return

It seems to have no provisions to handle any incoming message that's derived from QueryMessage.

Further, the only call to the Handle virtual method that all these messages implement seems to be locked behind the "Response" flow of this loop

response.Handle (Engine, node);

Is this intentional? I would think that this loop should also be responding to fresh queries from others, not just responses to its own outbound messages.

Something like

 if (rawResponse is QueryMessage q) {
     q.Handle (Engine, node);
 }

stuck inside that loop as well +/- the other event and logging handlers that I have to admit I don't completely grok on first read.

Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant