-
Notifications
You must be signed in to change notification settings - Fork 133
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
Feature request: share and/or cache message connections to remote clients #663
Comments
Thanks @jpdillingham. I think there a number of reasons to recycle existing connections. You've raised some good ones. If that was fixed, I have a sneaking suspicion that a lot of connection and transfer issues people have been having over the years may disappear. I'm not sure if we are re-allocating sockets too, but if that's the case, the first thing that came to my mind was that they can be an expensive resource to allocate on some platforms. |
Peer connectivity is definitely an area that should be improved, the code related to direct/indirect connections in particular should be carefully reviewed. I've never liked the fact that Nicotine+ contains the "I can receive direct connections" checkbox, as it has already resulted in bug reports because it was set to the wrong mode. |
@jpdillingham I believe I've fixed this issue in the following branch: Testing would be appreciated, to ensure I haven't screwed something up. |
We've just finished testing this problem. Seems to work. 👍 |
Switched to a new branch: Windows builds if necessary (use 32-bit for now, 64-bit is broken): |
@mathiascode great! I'll take a look in a bit. |
@mathiascode getting (looks truncated?):
|
64-bit Windows builds broke recently due to some package updates, I will fix them before the next release. Until then, use the 32-bit build. |
@mathiascode Works! |
Great, thanks for testing! |
If anyone else reads this issue in the future, here's some backstory I found for the previous "I can receive direct connections" option: http://web.archive.org/web/20100802111948/http://nicotine.thegraveyard.org/cgi-bin/faqw.py?req=show&file=faq04.002.htp |
Perhaps add a FAQ document in the wiki? |
Since we don't have that option anymore, I don't think that's necessary. I'd rather avoid FAQs as much as possible, since many users don't seem to read these in my experience. Things should be more obvious in the UI, or have a small explanation next to them in the UI, if necessary. |
Describe the solution you'd like
Presently, Nicotine+ attempts to negotiate a message connection for each message (at least, each transfer request) it tries to send. Negotiating a single connection and then reusing it to send subsequent messages until it is disconnected would improve performance and help prevent socket exhaustion.
In addition to potential performance gains, I'm also selfishly requesting this change to improve interoperability between Nicotine+ and my Soulseek.NET library.
Additional context
The official Soulseek clients happily supercede existing connections when a new one is established, but when connections are superseded you risk losing messages that were in flight (depending on how concurrent this operation is in your application, this may not be a big deal for Nicotine+).
With Soulseek.NET, I maintain a connection cache which only supersedes connections when a new one is established directly by way of a connection on the listening port (official clients consider this superceded on their end so this isn't my choice to make). For 'connect to peer' requests, if a connection is cached then the connect to peer request is ignored. This works well with Soulseek NS and QT.
Presently, when requesting the download of multiple files from Soulseek.NET from Nicotine+, I receive a 'connect to peer' request for each file requested, but because I only allow one connection at a time to connect, I only get one transfer request. The subsequent requests fail with a connection error, after waiting in "Getting address" for some time. There's a compounding issue regarding direct/indirect connections where only an indirect connection is attempted if the "I can accept direct connections" is ticked in settings. Attempting both types of connections by default would solve this issue when the remote client can accept direct connections.
I could solve this problem by allowing 'connect to peer' requests to supercede established connections, but in some limited testing this morning I experienced some dropped messages (due to concurrency issues between message handling and connection hand-off), and I'm concerned about issues that would arise when receiving search results with this enabled with regard to socket exhaustion.
The text was updated successfully, but these errors were encountered: