(opt-in) use curl for tracker communication - #8159
(opt-in) use curl for tracker communication#8159TheBaronVladimirHarkonnen wants to merge 9 commits into
Conversation
|
please simplify this patch. also, review it to make sure you don't duplicate any functionality. also, make sure you have CI test coverage of the new functionality. |
|
btw. I would think the main issue with tracker announces right now is that there's no support for pipelining. If multiple torrents use the same tracker, they shouldn't each have to connect and SSL handshake. |
You make a good point, I agree that this is both easy to implement in boost and cleaner to integrate into the current code base. The reason why I'm more interested in curl is as follows:
I'm not happy with the current state of curl but it is the best library out there. Thinking about the future is important too, will the simple boost implementation be good enough 10 years from now? I would like the think we are all using the new advanced HTTP features by then. Don't be afraid to reject the integration of curl if you don't like the idea, I would totally understand. |
|
just a status update, I'm still busy reworking this. |
…k request filter into shared common code, simplifications
|
needs more work, don't review yet. |
Looking forward to whenever you have time for this. The fact we need to create and tear down a connection with all the overhead (especially SSL announces) that entails is quite sad. Hope to see modern approaches adopted in our favorite tools! 👍 |
|
@seabashed Currently I'm working on creating a custom HTTP request queuing system to avoid using the curl queuing system entirely. The curl queuing was not made for applications like Libtorrent and we are better of not using it. This queuing creates a separate queue per tracker:
The balance is between not creating too many connections, but at the same time being able to send all announces at startup/shutdown in a reasonable time-frame. |
|
Thanks @TheBaronVladimirHarkonnen, is this still worth pursuing or effectively replaced by @arvidn's work on 9654c51? |
fixes #4334
closes #8025
Goal
Connection reuse improves efficiency for both the client and server side. Coupled with support for SSL session reuse and advanced HTTP features, this implementation reduces the computing cost of implementing encryption in HTTP trackers.
Hopefully, this will stimulate more trackers to adopt encryption.
Breaking changes
Breaking changes (with respect to the reference http_connection_tracker implementation):
send_host_in_connectis ignored because it is required for curl's HTTP/1.x proxy and cannot be turned off. I suggest removing the setting and always turning it on.proxy_hostnamesis ignored for HTTP proxies, because it is required in curl's HTTP proxy implementation.Relevant curl issues:
Questions:
libtorrent/aux_/deadline_timer.hppuses system_clock, which is not resistant to time jumps. Any chance of changing it to steady_clock?Unit test coverage:
curl=onallows running all current tests for the curl HTTP stack.Can be implemented by stubbing the curl_pool, and redirecting the curl_easy_* calls to secretly use the http_connection class. Is this desired? should this be a separate PR to keep this one small?
Testing:
https://github.com/TheBaronVladimirHarkonnen/docker-qbittorrent-nox
curl_debug=onall the HTTP connection information is logged. Observed that the connections are being reused.curl=on, no degradation in test running times.Implementation design:
O(1)per HTTP request, usingO(N)to processNrequests. However, the libcurl multi interface uses naive algorithms withO(N^2)time complexity (inside libcurl for queuing and list operations).