fix some compiler warnings
This commit is contained in:
parent
e51e953cb9
commit
57769bab11
|
@ -756,7 +756,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// peer id
|
// peer id
|
||||||
memcpy(ptr, &m_ses.get_peer_id()[0], 20);
|
memcpy(ptr, &m_ses.get_peer_id()[0], 20);
|
||||||
ptr += 20;
|
// ptr += 20;
|
||||||
|
|
||||||
#ifdef TORRENT_VERBOSE_LOGGING
|
#ifdef TORRENT_VERBOSE_LOGGING
|
||||||
peer_log("==> HANDSHAKE [ ih: %s ]", to_hex(ih.to_string()).c_str());
|
peer_log("==> HANDSHAKE [ ih: %s ]", to_hex(ih.to_string()).c_str());
|
||||||
|
|
|
@ -90,6 +90,7 @@ namespace libtorrent
|
||||||
m_queue.push_front(entry());
|
m_queue.push_front(entry());
|
||||||
e = &m_queue.front();
|
e = &m_queue.front();
|
||||||
break;
|
break;
|
||||||
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
e->priority = priority;
|
e->priority = priority;
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace libtorrent
|
||||||
if (size < 2) return -1;
|
if (size < 2) return -1;
|
||||||
|
|
||||||
size -= 2;
|
size -= 2;
|
||||||
buffer += 2;
|
// buffer += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total_size - size;
|
return total_size - size;
|
||||||
|
|
|
@ -293,8 +293,8 @@ namespace libtorrent
|
||||||
if (ptr == 0 || expect2 == 0 || strcmp(expect2, ptr)) { handle_error(invalid_response, h); return; }
|
if (ptr == 0 || expect2 == 0 || strcmp(expect2, ptr)) { handle_error(invalid_response, h); return; }
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char const* message = 0;
|
// char const* message = 0;
|
||||||
float version = 3.0f;
|
// float version = 3.0f;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -324,11 +324,11 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
else if (strcmp("MESSAGE", name) == 0)
|
else if (strcmp("MESSAGE", name) == 0)
|
||||||
{
|
{
|
||||||
message = ptr;
|
// message = ptr;
|
||||||
}
|
}
|
||||||
else if (strcmp("VERSION", name) == 0)
|
else if (strcmp("VERSION", name) == 0)
|
||||||
{
|
{
|
||||||
version = float(atof(ptr));
|
// version = float(atof(ptr));
|
||||||
}
|
}
|
||||||
else if (strcmp("VALUE", name) == 0)
|
else if (strcmp("VALUE", name) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -379,7 +379,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!done)
|
if (!done)
|
||||||
{
|
{
|
||||||
for (bucket_t::iterator i = rb.begin(), end(rb.end());
|
for (bucket_t::iterator i = rb.begin(), end(rb.end());
|
||||||
i != end; ++i)
|
i != end; ++i)
|
||||||
{
|
{
|
||||||
|
@ -388,7 +388,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
TORRENT_LOG(table) << "node ID changed, deleting old entry: "
|
TORRENT_LOG(table) << "node ID changed, deleting old entry: "
|
||||||
<< i->id << " " << i->addr;
|
<< i->id << " " << i->addr;
|
||||||
#endif
|
#endif
|
||||||
rb.erase(i);
|
rb.erase(i);
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table_t::iterator i = find_bucket(e.id);
|
table_t::iterator i = find_bucket(e.id);
|
||||||
bucket_t& b = i->live_nodes;
|
bucket_t& b = i->live_nodes;
|
||||||
bucket_t& rb = i->replacements;
|
bucket_t& rb = i->replacements;
|
||||||
|
|
||||||
|
|
|
@ -3746,9 +3746,6 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
p.estimated_reciprocation_rate = m_est_reciprocation_rate;
|
p.estimated_reciprocation_rate = m_est_reciprocation_rate;
|
||||||
int upload_capacity = m_ses.settings().upload_rate_limit;
|
|
||||||
if (upload_capacity == 0)
|
|
||||||
upload_capacity = (std::max)(20000, m_ses.m_peak_up_rate + 10000);
|
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
p.local_endpoint = get_socket()->local_endpoint(ec);
|
p.local_endpoint = get_socket()->local_endpoint(ec);
|
||||||
|
|
|
@ -514,6 +514,9 @@ namespace libtorrent
|
||||||
error_code ec;
|
error_code ec;
|
||||||
int ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
|
int ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
|
||||||
TORRENT_ASSERT(ret == 0);
|
TORRENT_ASSERT(ret == 0);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
if (ret != 0) throw libtorrent_exception(ec);
|
||||||
|
#endif
|
||||||
TORRENT_SYNC_CALL1(load_state, &e);
|
TORRENT_SYNC_CALL1(load_state, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -545,6 +545,9 @@ namespace libtorrent
|
||||||
memcpy(m_info_section.get(), t.m_info_section.get(), m_info_section_size);
|
memcpy(m_info_section.get(), t.m_info_section.get(), m_info_section_size);
|
||||||
int ret = lazy_bdecode(m_info_section.get(), m_info_section.get()
|
int ret = lazy_bdecode(m_info_section.get(), m_info_section.get()
|
||||||
+ m_info_section_size, m_info_dict, ec);
|
+ m_info_section_size, m_info_dict, ec);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
if (ret != 0) throw libtorrent_exception(ec);
|
||||||
|
#endif
|
||||||
TORRENT_ASSERT(ret == 0);
|
TORRENT_ASSERT(ret == 0);
|
||||||
|
|
||||||
ptrdiff_t offset = m_info_section.get() - t.m_info_section.get();
|
ptrdiff_t offset = m_info_section.get() - t.m_info_section.get();
|
||||||
|
@ -591,7 +594,7 @@ namespace libtorrent
|
||||||
if (tmp.size() == 0 || lazy_bdecode(&tmp[0], &tmp[0] + tmp.size(), e, ec) != 0)
|
if (tmp.size() == 0 || lazy_bdecode(&tmp[0], &tmp[0] + tmp.size(), e, ec) != 0)
|
||||||
{
|
{
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
throw invalid_torrent_file(errors::invalid_bencoding);
|
throw invalid_torrent_file(ec);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2677,15 +2677,15 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
||||||
// within reasonable bounds. The one-way delay is never
|
// within reasonable bounds. The one-way delay is never
|
||||||
// higher than the round-trip time.
|
// higher than the round-trip time.
|
||||||
|
|
||||||
// it's impossible for delay to be more than the RTT, so make
|
|
||||||
// sure to clamp it as a sanity check
|
|
||||||
if (delay > min_rtt) delay = min_rtt;
|
|
||||||
|
|
||||||
// only use the minimum from the last 3 delay measurements
|
|
||||||
delay = *std::min_element(m_delay_sample_hist, m_delay_sample_hist + num_delay_hist);
|
|
||||||
|
|
||||||
if (sample && acked_bytes && prev_bytes_in_flight)
|
if (sample && acked_bytes && prev_bytes_in_flight)
|
||||||
{
|
{
|
||||||
|
// it's impossible for delay to be more than the RTT, so make
|
||||||
|
// sure to clamp it as a sanity check
|
||||||
|
if (delay > min_rtt) delay = min_rtt;
|
||||||
|
|
||||||
|
// only use the minimum from the last 3 delay measurements
|
||||||
|
delay = *std::min_element(m_delay_sample_hist, m_delay_sample_hist + num_delay_hist);
|
||||||
|
|
||||||
do_ledbat(acked_bytes, delay, prev_bytes_in_flight, receive_time);
|
do_ledbat(acked_bytes, delay, prev_bytes_in_flight, receive_time);
|
||||||
m_send_delay = delay;
|
m_send_delay = delay;
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,9 +771,6 @@ namespace libtorrent
|
||||||
|
|
||||||
if (!m_requests.empty())
|
if (!m_requests.empty())
|
||||||
{
|
{
|
||||||
range_overlaps_request = in_range.start + in_range.length
|
|
||||||
> m_requests.front().start + int(m_piece.size());
|
|
||||||
|
|
||||||
if (in_range.start + in_range.length < m_requests.front().start + m_requests.front().length
|
if (in_range.start + in_range.length < m_requests.front().start + m_requests.front().length
|
||||||
&& (m_received_body + recv_buffer.left() >= range_end - range_start))
|
&& (m_received_body + recv_buffer.left() >= range_end - range_start))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue