lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

NetMessageType.Discovery unhandled when connected #119

Open Skyppid opened 5 years ago

Skyppid commented 5 years ago

I am currently using the Discovery feature in order to find new "components" in the network (a component being any kind of app which supports the protocol and may interact with other components) and to update existing ones' information (name and some other meta data) regularly.

I see that discovery doesn't work for connected instances. As long as there is no active connection, I get and handle request and response, but once connected I don't get those messages anymore. So far so good, I can handle this otherwise.

But is this intentional, that I receive a warning whenever a request comes in? This floods my log and I kinda don't see the point of it. Even if connected and even if the connected party requests a discovery, why wouldn't I be able to handle it? I could still drop it, but this just looks like some kind of bug or "Not yet implemented" thing.

Is it? Because then I'd try to fix that and do a PR.

JimmyCushnie commented 3 years ago

I think this is intentional behavior. Discovery is for discovering peers, not for learning about peers you already know exist.

For your usage case I think you should probably have two NetPeers: one for discovering, one for connecting.

Skyppid commented 3 years ago

Maybe yeah. I worked around that by sending custom messages identical to my discoveries in a fixed time interval. Not so sure about the scenario anymore though since this was two years ago.