http_tracker connection fix and proxy support for udp-trackers
This commit is contained in:
parent
187b4c423d
commit
f940a4c4db
|
@ -1707,6 +1707,8 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(block.block_index < t->torrent_file().piece_size(block.piece_index));
|
TORRENT_ASSERT(block.block_index < t->torrent_file().piece_size(block.piece_index));
|
||||||
TORRENT_ASSERT(!t->picker().is_requested(block) || (t->picker().num_peers(block) > 0));
|
TORRENT_ASSERT(!t->picker().is_requested(block) || (t->picker().num_peers(block) > 0));
|
||||||
TORRENT_ASSERT(!t->have_piece(block.piece_index));
|
TORRENT_ASSERT(!t->have_piece(block.piece_index));
|
||||||
|
TORRENT_ASSERT(std::find(m_download_queue.begin(), m_download_queue.end(), block) == m_download_queue.end());
|
||||||
|
TORRENT_ASSERT(std::find(m_request_queue.begin(), m_request_queue.end(), block) == m_request_queue.end());
|
||||||
|
|
||||||
piece_picker::piece_state_t state;
|
piece_picker::piece_state_t state;
|
||||||
peer_speed_t speed = peer_speed();
|
peer_speed_t speed = peer_speed();
|
||||||
|
|
|
@ -1262,6 +1262,8 @@ namespace detail
|
||||||
{
|
{
|
||||||
torrent& t = *i->second;
|
torrent& t = *i->second;
|
||||||
if (t.want_more_peers())
|
if (t.want_more_peers())
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (t.try_connect_peer())
|
if (t.try_connect_peer())
|
||||||
{
|
{
|
||||||
|
@ -1269,6 +1271,15 @@ namespace detail
|
||||||
steps_since_last_connect = 0;
|
steps_since_last_connect = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (std::bad_alloc&)
|
||||||
|
{
|
||||||
|
// we ran out of memory trying to connect to a peer
|
||||||
|
// lower the global limit to the number of peers
|
||||||
|
// we already have
|
||||||
|
m_max_connections = num_connections();
|
||||||
|
if (m_max_connections < 2) m_max_connections = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
++m_next_connect_torrent;
|
++m_next_connect_torrent;
|
||||||
++steps_since_last_connect;
|
++steps_since_last_connect;
|
||||||
++i;
|
++i;
|
||||||
|
@ -2406,8 +2417,10 @@ namespace detail
|
||||||
m_buffer_usage_logger << log_time() << " protocol_buffer: "
|
m_buffer_usage_logger << log_time() << " protocol_buffer: "
|
||||||
<< (m_buffer_allocations * send_buffer_size) << std::endl;
|
<< (m_buffer_allocations * send_buffer_size) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return std::make_pair((char*)m_send_buffers.ordered_malloc(num_buffers)
|
std::pair<char*, int> ret((char*)m_send_buffers.ordered_malloc(num_buffers)
|
||||||
, num_buffers * send_buffer_size);
|
, num_buffers * send_buffer_size);
|
||||||
|
if (ret.first == 0) throw std::bad_alloc();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::free_buffer(char* buf, int size)
|
void session_impl::free_buffer(char* buf, int size)
|
||||||
|
|
Loading…
Reference in New Issue