forked from premiere/premiere-libtorrent
merged changes from RC_1_0
This commit is contained in:
parent
939411488e
commit
32d368e1ce
|
@ -31,6 +31,7 @@
|
||||||
* almost completely changed the storage interface (for custom storage)
|
* almost completely changed the storage interface (for custom storage)
|
||||||
* added support for hashing pieces in multiple threads
|
* added support for hashing pieces in multiple threads
|
||||||
|
|
||||||
|
* fix protocol race-condition in super seeding mode
|
||||||
* support read-only DHT nodes
|
* support read-only DHT nodes
|
||||||
* remove unused partial hash DHT lookups
|
* remove unused partial hash DHT lookups
|
||||||
* remove potentially privacy leaking extension (non-anonymous mode)
|
* remove potentially privacy leaking extension (non-anonymous mode)
|
||||||
|
|
|
@ -250,6 +250,7 @@ namespace libtorrent
|
||||||
|
|
||||||
sha1_hash const& info_hash() const
|
sha1_hash const& info_hash() const
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(m_torrent_file);
|
||||||
static sha1_hash empty;
|
static sha1_hash empty;
|
||||||
return m_torrent_file ? m_torrent_file->info_hash() : empty;
|
return m_torrent_file ? m_torrent_file->info_hash() : empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -823,6 +823,13 @@ namespace libtorrent
|
||||||
ptr += 20;
|
ptr += 20;
|
||||||
|
|
||||||
#ifdef TORRENT_VERBOSE_LOGGING
|
#ifdef TORRENT_VERBOSE_LOGGING
|
||||||
|
{
|
||||||
|
char hex_pid[41];
|
||||||
|
to_hex((char const*)&m_our_peer_id[0], 20, hex_pid);
|
||||||
|
hex_pid[40] = 0;
|
||||||
|
peer_log(">>> sent peer_id: %s client: %s"
|
||||||
|
, hex_pid, identify_client(m_our_peer_id).c_str());
|
||||||
|
}
|
||||||
peer_log("==> HANDSHAKE [ ih: %s ]", to_hex(ih.to_string()).c_str());
|
peer_log("==> HANDSHAKE [ ih: %s ]", to_hex(ih.to_string()).c_str());
|
||||||
#endif
|
#endif
|
||||||
send_buffer(handshake, sizeof(handshake));
|
send_buffer(handshake, sizeof(handshake));
|
||||||
|
@ -3275,7 +3282,7 @@ namespace libtorrent
|
||||||
if (is_print(recv_buffer.begin[i])) ascii_pid[i] = recv_buffer.begin[i];
|
if (is_print(recv_buffer.begin[i])) ascii_pid[i] = recv_buffer.begin[i];
|
||||||
else ascii_pid[i] = '.';
|
else ascii_pid[i] = '.';
|
||||||
}
|
}
|
||||||
peer_log("<<< received peer_id: %s client: %s\nas ascii: %s\n"
|
peer_log("<<< received peer_id: %s client: %s ascii: \"%s\""
|
||||||
, hex_pid, identify_client(peer_id(recv_buffer.begin)).c_str(), ascii_pid);
|
, hex_pid, identify_client(peer_id(recv_buffer.begin)).c_str(), ascii_pid);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1905,13 +1905,6 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(t);
|
TORRENT_ASSERT(t);
|
||||||
|
|
||||||
choke_this_peer();
|
choke_this_peer();
|
||||||
|
|
||||||
if (t->super_seeding())
|
|
||||||
{
|
|
||||||
// maybe we need to try another piece, to see if the peer
|
|
||||||
// is interested in us then
|
|
||||||
superseed_piece(-1, t->get_piece_to_super_seed(m_have_piece));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void peer_connection::choke_this_peer()
|
void peer_connection::choke_this_peer()
|
||||||
|
@ -4787,6 +4780,15 @@ namespace libtorrent
|
||||||
send_block_requests();
|
send_block_requests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (t->super_seeding()
|
||||||
|
&& !m_peer_interested
|
||||||
|
&& m_became_uninterested + seconds(10) < now)
|
||||||
|
{
|
||||||
|
// maybe we need to try another piece, to see if the peer
|
||||||
|
// become interested in us then
|
||||||
|
superseed_piece(-1, t->get_piece_to_super_seed(m_have_piece));
|
||||||
|
}
|
||||||
|
|
||||||
on_tick();
|
on_tick();
|
||||||
if (is_disconnecting()) return;
|
if (is_disconnecting()) return;
|
||||||
|
|
||||||
|
|
|
@ -4764,14 +4764,6 @@ namespace libtorrent
|
||||||
avail_vec.push_back(i);
|
avail_vec.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_availability > 1)
|
|
||||||
{
|
|
||||||
// if the minimum availability is 2 or more,
|
|
||||||
// we shouldn't be super seeding any more
|
|
||||||
super_seeding(false);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return avail_vec[random() % avail_vec.size()];
|
return avail_vec[random() % avail_vec.size()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,12 @@ void test_swarm(int flags)
|
||||||
torrent_status st2 = tor2.status();
|
torrent_status st2 = tor2.status();
|
||||||
torrent_status st3 = tor3.status();
|
torrent_status st3 = tor3.status();
|
||||||
|
|
||||||
|
if (flags & super_seeding)
|
||||||
|
{
|
||||||
|
TEST_CHECK(st1.is_seeding);
|
||||||
|
TEST_CHECK(st1.super_seeding);
|
||||||
|
}
|
||||||
|
|
||||||
if (st2.progress < 1.f && st2.progress > 0.5f)
|
if (st2.progress < 1.f && st2.progress > 0.5f)
|
||||||
{
|
{
|
||||||
sum_dl_rate2 += st2.download_payload_rate;
|
sum_dl_rate2 += st2.download_payload_rate;
|
||||||
|
|
|
@ -29,6 +29,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
|
|
||||||
int EXPORT run_http_suite(int proxy, char const* protocol
|
int EXPORT run_http_suite(int proxy, char const* protocol
|
||||||
|
|
Loading…
Reference in New Issue