From 73bb0c05ad879ea1121bf7b2063007f53bbe0f77 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 15 Sep 2007 20:17:23 +0000 Subject: [PATCH] added 'incoming' peer source --- include/libtorrent/peer_info.hpp | 3 ++- src/bt_peer_connection.cpp | 2 +- src/piece_picker.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index 046df2a6b..b07acffd4 100755 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -72,7 +72,8 @@ namespace libtorrent dht = 0x2, pex = 0x4, lsd = 0x8, - resume_data = 0x10 + resume_data = 0x10, + incoming = 0x20 }; int source; diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 11a39675f..f7f137437 100755 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -1221,7 +1221,7 @@ namespace libtorrent { tcp::endpoint adr(remote().address() , (unsigned short)listen_port->integer()); - t->get_policy().peer_from_tracker(adr, pid(), 0, 0); + t->get_policy().peer_from_tracker(adr, pid(), peer_info::incoming, 0); } } // there should be a version too diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 8fa623fa3..aff15dd95 100755 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -1229,6 +1229,7 @@ namespace libtorrent bool piece_picker::can_pick(int piece, std::vector const& bitmask) const { + assert(piece >= 0 && piece < int(m_piece_map.size())); return bitmask[piece] && !m_piece_map[piece].have() && !m_piece_map[piece].downloading