added 'incoming' peer source

This commit is contained in:
Arvid Norberg 2007-09-15 20:17:23 +00:00
parent bdd14cc155
commit 73bb0c05ad
3 changed files with 4 additions and 2 deletions

View File

@ -72,7 +72,8 @@ namespace libtorrent
dht = 0x2, dht = 0x2,
pex = 0x4, pex = 0x4,
lsd = 0x8, lsd = 0x8,
resume_data = 0x10 resume_data = 0x10,
incoming = 0x20
}; };
int source; int source;

View File

@ -1221,7 +1221,7 @@ namespace libtorrent
{ {
tcp::endpoint adr(remote().address() tcp::endpoint adr(remote().address()
, (unsigned short)listen_port->integer()); , (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 // there should be a version too

View File

@ -1229,6 +1229,7 @@ namespace libtorrent
bool piece_picker::can_pick(int piece, std::vector<bool> const& bitmask) const bool piece_picker::can_pick(int piece, std::vector<bool> const& bitmask) const
{ {
assert(piece >= 0 && piece < int(m_piece_map.size()));
return bitmask[piece] return bitmask[piece]
&& !m_piece_map[piece].have() && !m_piece_map[piece].have()
&& !m_piece_map[piece].downloading && !m_piece_map[piece].downloading