lt sync 2696
This commit is contained in:
parent
ec180b3735
commit
9d5be3e631
|
@ -104,9 +104,9 @@ namespace aux
|
||||||
, bucket_iterator_t end)
|
, bucket_iterator_t end)
|
||||||
: m_bucket_iterator(begin)
|
: m_bucket_iterator(begin)
|
||||||
, m_bucket_end(end)
|
, m_bucket_end(end)
|
||||||
, m_iterator(begin != end ? begin->first.begin() : bucket_t::const_iterator())
|
|
||||||
{
|
{
|
||||||
if (m_bucket_iterator == m_bucket_end) return;
|
if (m_bucket_iterator == m_bucket_end) return;
|
||||||
|
m_iterator = begin->first.begin();
|
||||||
while (m_iterator == m_bucket_iterator->first.end())
|
while (m_iterator == m_bucket_iterator->first.end())
|
||||||
{
|
{
|
||||||
if (++m_bucket_iterator == m_bucket_end)
|
if (++m_bucket_iterator == m_bucket_end)
|
||||||
|
@ -119,14 +119,14 @@ namespace aux
|
||||||
{
|
{
|
||||||
return m_bucket_iterator == other.m_bucket_iterator
|
return m_bucket_iterator == other.m_bucket_iterator
|
||||||
&& (m_bucket_iterator == m_bucket_end
|
&& (m_bucket_iterator == m_bucket_end
|
||||||
|| m_iterator == other.m_iterator);
|
|| *m_iterator == other.m_iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void increment()
|
void increment()
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_bucket_iterator != m_bucket_end);
|
TORRENT_ASSERT(m_bucket_iterator != m_bucket_end);
|
||||||
++m_iterator;
|
++*m_iterator;
|
||||||
while (m_iterator == m_bucket_iterator->first.end())
|
while (*m_iterator == m_bucket_iterator->first.end())
|
||||||
{
|
{
|
||||||
if (++m_bucket_iterator == m_bucket_end)
|
if (++m_bucket_iterator == m_bucket_end)
|
||||||
break;
|
break;
|
||||||
|
@ -137,12 +137,16 @@ namespace aux
|
||||||
node_entry const& dereference() const
|
node_entry const& dereference() const
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_bucket_iterator != m_bucket_end);
|
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_iterator;
|
||||||
bucket_iterator_t m_bucket_end;
|
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
|
} // namespace aux
|
||||||
|
|
|
@ -79,6 +79,8 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
if (addr.is_v4())
|
if (addr.is_v4())
|
||||||
return addr.to_v4() == address_v4::any();
|
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
|
else
|
||||||
return addr.to_v6() == address_v6::any();
|
return addr.to_v6() == address_v6::any();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1314,7 +1314,11 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
address_v6::bytes_type bytes;
|
address_v6::bytes_type bytes;
|
||||||
std::copy(myip.begin(), myip.end(), bytes.begin());
|
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;
|
if (t->is_finished()) handshake["upload_only"] = 1;
|
||||||
|
|
||||||
tcp::endpoint ep = m_ses.get_ipv6_interface();
|
tcp::endpoint ep = m_ses.get_ipv6_interface();
|
||||||
if (ep != tcp::endpoint())
|
if (!is_any(ep.address()))
|
||||||
{
|
{
|
||||||
std::string ipv6_address;
|
std::string ipv6_address;
|
||||||
std::back_insert_iterator<std::string> out(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());
|
TORRENT_ASSERT(!m_rc4_encrypted || m_RC4_handler.get());
|
||||||
#endif
|
#endif
|
||||||
|
if (is_seed()) TORRENT_ASSERT(upload_only());
|
||||||
|
|
||||||
if (!in_handshake())
|
if (!in_handshake())
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_sent_handshake);
|
TORRENT_ASSERT(m_sent_handshake);
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace libtorrent
|
||||||
entry e;
|
entry e;
|
||||||
e = bdecode(data, data + size);
|
e = bdecode(data, data + size);
|
||||||
|
|
||||||
if (e.type() != entry::undefined_t)
|
if (e.type() == entry::dictionary_t)
|
||||||
{
|
{
|
||||||
parse(parser.status_code(), e);
|
parse(parser.status_code(), e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,6 +519,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
// if this is a web seed. we don't have a peer_info struct
|
// if this is a web seed. we don't have a peer_info struct
|
||||||
if (m_peer_info) m_peer_info->seed = true;
|
if (m_peer_info) m_peer_info->seed = true;
|
||||||
|
m_upload_only = true;
|
||||||
|
|
||||||
t->peer_has_all();
|
t->peer_has_all();
|
||||||
if (t->is_finished()) send_not_interested();
|
if (t->is_finished()) send_not_interested();
|
||||||
|
|
|
@ -770,8 +770,7 @@ namespace libtorrent
|
||||||
seed = true;
|
seed = true;
|
||||||
for (int i = 0; i < slots->list_size(); ++i)
|
for (int i = 0; i < slots->list_size(); ++i)
|
||||||
{
|
{
|
||||||
lazy_entry const* e = slots->list_at(i);
|
if (slots->list_int_value_at(i, -1) >= 0) continue;
|
||||||
if (e->list_int_value_at(i, -1) >= 0) continue;
|
|
||||||
seed = false;
|
seed = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue