lt sync 2696

This commit is contained in:
Andrew Resch 2008-09-21 01:44:11 +00:00
parent ec180b3735
commit 9d5be3e631
6 changed files with 23 additions and 11 deletions

View File

@ -104,9 +104,9 @@ namespace aux
, bucket_iterator_t end)
: m_bucket_iterator(begin)
, m_bucket_end(end)
, m_iterator(begin != end ? begin->first.begin() : bucket_t::const_iterator())
{
if (m_bucket_iterator == m_bucket_end) return;
m_iterator = begin->first.begin();
while (m_iterator == m_bucket_iterator->first.end())
{
if (++m_bucket_iterator == m_bucket_end)
@ -119,14 +119,14 @@ namespace aux
{
return m_bucket_iterator == other.m_bucket_iterator
&& (m_bucket_iterator == m_bucket_end
|| m_iterator == other.m_iterator);
|| *m_iterator == other.m_iterator);
}
void increment()
{
TORRENT_ASSERT(m_bucket_iterator != m_bucket_end);
++m_iterator;
while (m_iterator == m_bucket_iterator->first.end())
++*m_iterator;
while (*m_iterator == m_bucket_iterator->first.end())
{
if (++m_bucket_iterator == m_bucket_end)
break;
@ -137,12 +137,16 @@ namespace aux
node_entry const& dereference() const
{
TORRENT_ASSERT(m_bucket_iterator != m_bucket_end);
return *m_iterator;
return **m_iterator;
}
bucket_iterator_t m_bucket_iterator;
bucket_iterator_t m_bucket_end;
bucket_t::const_iterator m_iterator;
// when debug iterators are enabled, default constructed
// iterators are not allowed to be copied. In the case
// where the routing table is empty, m_iterator would be
// default constructed and not copyable.
boost::optional<bucket_t::const_iterator> m_iterator;
};
} // namespace aux

View File

@ -79,6 +79,8 @@ namespace libtorrent
{
if (addr.is_v4())
return addr.to_v4() == address_v4::any();
else if (addr.to_v6().is_v4_mapped())
return (addr.to_v6().to_v4() == address_v4::any());
else
return addr.to_v6() == address_v6::any();
}

View File

@ -1314,7 +1314,11 @@ namespace libtorrent
{
address_v6::bytes_type bytes;
std::copy(myip.begin(), myip.end(), bytes.begin());
m_ses.set_external_address(address_v6(bytes));
address_v6 ipv6_address(bytes);
if (ipv6_address.is_v4_mapped())
m_ses.set_external_address(ipv6_address.to_v4());
else
m_ses.set_external_address(ipv6_address);
}
}
@ -1567,7 +1571,7 @@ namespace libtorrent
if (t->is_finished()) handshake["upload_only"] = 1;
tcp::endpoint ep = m_ses.get_ipv6_interface();
if (ep != tcp::endpoint())
if (!is_any(ep.address()))
{
std::string ipv6_address;
std::back_insert_iterator<std::string> out(ipv6_address);
@ -2635,6 +2639,8 @@ namespace libtorrent
TORRENT_ASSERT(!m_rc4_encrypted || m_RC4_handler.get());
#endif
if (is_seed()) TORRENT_ASSERT(upload_only());
if (!in_handshake())
{
TORRENT_ASSERT(m_sent_handshake);

View File

@ -236,7 +236,7 @@ namespace libtorrent
entry e;
e = bdecode(data, data + size);
if (e.type() != entry::undefined_t)
if (e.type() == entry::dictionary_t)
{
parse(parser.status_code(), e);
}

View File

@ -519,6 +519,7 @@ namespace libtorrent
#endif
// if this is a web seed. we don't have a peer_info struct
if (m_peer_info) m_peer_info->seed = true;
m_upload_only = true;
t->peer_has_all();
if (t->is_finished()) send_not_interested();

View File

@ -770,8 +770,7 @@ namespace libtorrent
seed = true;
for (int i = 0; i < slots->list_size(); ++i)
{
lazy_entry const* e = slots->list_at(i);
if (e->list_int_value_at(i, -1) >= 0) continue;
if (slots->list_int_value_at(i, -1) >= 0) continue;
seed = false;
break;
}