23 Mar 2011 04:39
Leave upload mode is too long. Proposed patch
Kharkov Alexander <kharkovalexander <at> gmail.com>
2011-03-23 03:39:06 GMT
2011-03-23 03:39:06 GMT
Hi, we've faced with following unexpected behavior, after leaving upload mode torrent download started after really long time. Investigation shows that behavior is following: - when torrent switched to upload only mode it periodically (default is 100 sec min_reconnect) reconnect to peers if they are seeds or upload onl do nothing for 20 sec (as it is upload mode) then connection dropped by remote side with ' no_request' error, so remote and local resources used for nothing (socket, connection, etc.). As connection closed peer last_connected time is shifted and next connect to this peer will be after 100 sec timeout. So when leaving upload mode torrent download will start only when 100 sec timeout exceeded after last connection to peer in upload mode, or even worse ~= 20 + 100 sec for connection which were opened in upload only mode when we leave it as for some reason this connections is not reused for download when we leave upload mode. There are the way to set min_reconnect timeout, but this is bad in general as we will force faster reconnects even to bad peers. There are also fast_reconnect flag on peer_connection but it is not suitable too, as we have no connections in upload mode most time, we have only peers. Attached patch resolve fast start of download after leaving upload mode (without touching existing behavior with timeouts) as following: * it reset last_connected timestamp when leaving upload mode, to force peer connection on nearest session ticks; * it close periodical connection in upload mode if remote side also in upload mode (or seed) with upload_to_upload error, as it is done when two seeders connected to each other, so connections and resources are not used for nothing (20 sec connection lock without real usage seems too long for high performance seed for example). We are using libtorrent 0.15.4, but patch is suitable for trunk too.
------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________ Libtorrent-discuss mailing list Libtorrent-discuss <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss