Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/0.16.16/src/libtorrent-rasterbar-0.16.16/include/libtorrent/socket.hpp b/0.16.16/src/libtorrent-rasterbar-0.16.16/include/libtorrent/socket.hpp
- index 058a18b..229e3e5 100644
- --- a/0.16.16/src/libtorrent-rasterbar-0.16.16/include/libtorrent/socket.hpp
- +++ b/0.16.16/src/libtorrent-rasterbar-0.16.16/include/libtorrent/socket.hpp
- @@ -64,7 +64,7 @@ POSSIBILITY OF SUCH DAMAGE.
- #include <boost/asio/read.hpp>
- #endif
- -#ifdef __OBJC__
- +#ifdef __OBJC__
- #undef Protocol
- #endif
- @@ -114,7 +114,7 @@ namespace libtorrent
- };
- #endif
- #endif
- -
- +
- #ifdef TORRENT_WINDOWS
- #ifndef IPV6_PROTECTION_LEVEL
- @@ -135,6 +135,20 @@ namespace libtorrent
- };
- #endif
- + struct traffic_class
- + {
- + traffic_class(char val): m_value(val) {}
- + template<class Protocol>
- + int level(Protocol const&) const { return IPPROTO_IPV6; }
- + template<class Protocol>
- + int name(Protocol const&) const { return IPV6_TCLASS; }
- + template<class Protocol>
- + int const* data(Protocol const&) const { return &m_value; }
- + template<class Protocol>
- + size_t size(Protocol const&) const { return sizeof(m_value); }
- + int m_value;
- + };
- +
- struct type_of_service
- {
- #ifdef WIN32
- diff --git a/0.16.16/src/libtorrent-rasterbar-0.16.16/src/parse_url.cpp b/0.16.16/src/libtorrent-rasterbar-0.16.16/src/parse_url.cpp
- index ee7f1d3..13d37a8 100644
- --- a/0.16.16/src/libtorrent-rasterbar-0.16.16/src/parse_url.cpp
- +++ b/0.16.16/src/libtorrent-rasterbar-0.16.16/src/parse_url.cpp
- @@ -128,6 +128,10 @@ namespace libtorrent
- }
- start = end;
- +
- + if (hostname[0] == '[')
- + hostname.assign(hostname.begin()+1, hostname.end()-1);
- +
- exit:
- return boost::make_tuple(protocol, auth, hostname, port
- , std::string(start, url.end()));
- diff --git a/0.16.16/src/libtorrent-rasterbar-0.16.16/src/peer_connection.cpp b/0.16.16/src/libtorrent-rasterbar-0.16.16/src/peer_connection.cpp
- index 2a94e51..ab80ee9 100644
- --- a/0.16.16/src/libtorrent-rasterbar-0.16.16/src/peer_connection.cpp
- +++ b/0.16.16/src/libtorrent-rasterbar-0.16.16/src/peer_connection.cpp
- @@ -409,7 +409,7 @@ namespace libtorrent
- , m_socket->type_name()
- , print_endpoint(local_ep).c_str());
- #endif
- -
- +
- #ifndef TORRENT_DISABLE_GEO_IP
- m_inet_as_name = m_ses.as_name_for_ip(m_remote.address());
- #endif
- @@ -424,7 +424,7 @@ namespace libtorrent
- {
- if (m_ses.m_disk_thread.is_disk_buffer(buffer))
- m_ses.m_disk_thread.rename_buffer(buffer, label);
- -
- +
- m_ses.m_buffer_usage_logger << log_time() << " append_send_buffer: " << size << std::endl;
- m_ses.log_buffer_usage();
- }
- @@ -533,12 +533,12 @@ namespace libtorrent
- // if the peers are still identical (say, they're both waiting to be unchoked)
- // fall through and rely on the logic to prioritize peers who have waited
- // the longest to be unchoked
- - }
- + }
- else if (m_ses.settings().seed_choking_algorithm == session_settings::fastest_upload)
- {
- c1 = uploaded_in_last_round();
- c2 = rhs.uploaded_in_last_round();
- -
- +
- // take torrent priority into account
- c1 *= 1 + t1->priority();
- c2 *= 1 + t2->priority();
- @@ -577,7 +577,7 @@ namespace libtorrent
- if (score1 > score2) return true;
- if (score2 > score1) return false;
- }
- -
- +
- // prioritize the one that has waited the longest to be unchoked
- // the round-robin unchoker relies on this logic. Don't change it
- // without moving this into that unchoker logic
- @@ -596,7 +596,7 @@ namespace libtorrent
- c1 = uploaded_in_last_round();
- c2 = p->uploaded_in_last_round();
- -
- +
- // take torrent priority into account
- c1 *= 1 + t1->priority();
- c2 *= 1 + t2->priority();
- @@ -638,6 +638,10 @@ namespace libtorrent
- peer_log(">>> SET_TOS[ tos: %d e: %s ]", m_ses.settings().peer_tos, ec.message().c_str());
- #endif
- }
- + else if (m_remote.address().is_v6())
- + {
- + m_socket->set_option(traffic_class(m_ses.settings().peer_tos), ec);
- + }
- }
- if (t && t->ready_for_connections())
- @@ -684,9 +688,9 @@ namespace libtorrent
- {
- if (!m_logger) return;
- - va_list v;
- + va_list v;
- va_start(v, fmt);
- -
- +
- char usr[400];
- vsnprintf(usr, sizeof(usr), fmt, v);
- va_end(v);
- @@ -845,7 +849,7 @@ namespace libtorrent
- }
- i = m_suggested_pieces.erase(i);
- }
- -
- +
- if (m_num_pieces == int(m_have_piece.size()))
- {
- #ifdef TORRENT_VERBOSE_LOGGING
- @@ -1005,7 +1009,7 @@ namespace libtorrent
- int peer_connection::picker_options() const
- {
- - int ret = 0;
- + int ret = 0;
- boost::shared_ptr<torrent> t = m_torrent.lock();
- TORRENT_ASSERT(t);
- if (!t) return 0;
- @@ -1119,12 +1123,12 @@ namespace libtorrent
- {
- return m_request_queue;
- }
- -
- +
- std::vector<pending_block> const& peer_connection::download_queue() const
- {
- return m_download_queue;
- }
- -
- +
- std::vector<peer_request> const& peer_connection::upload_queue() const
- {
- return m_requests;
- @@ -1182,7 +1186,7 @@ namespace libtorrent
- }
- #endif
- }
- -
- +
- size_type peer_connection::total_free_upload() const
- {
- return m_free_upload;
- @@ -1406,7 +1410,7 @@ namespace libtorrent
- m_download_queue.begin(), m_download_queue.end()
- , boost::bind(match_request, boost::cref(r), boost::bind(&pending_block::block, _1)
- , t->block_size()));
- -
- +
- #ifdef TORRENT_VERBOSE_LOGGING
- peer_log("<== REJECT_PIECE [ piece: %d | s: %d | l: %d ]"
- , r.piece, r.start, r.length);
- @@ -1420,7 +1424,7 @@ namespace libtorrent
- TORRENT_ASSERT(m_outstanding_bytes >= r.length);
- m_outstanding_bytes -= r.length;
- if (m_outstanding_bytes < 0) m_outstanding_bytes = 0;
- -
- +
- // if the peer is in parole mode, keep the request
- if (peer_info_struct() && peer_info_struct()->on_parole)
- {
- @@ -1470,7 +1474,7 @@ namespace libtorrent
- send_block_requests();
- }
- }
- -
- +
- // -----------------------------
- // ------- SUGGEST PIECE -------
- // -----------------------------
- @@ -1501,7 +1505,7 @@ namespace libtorrent
- #endif
- return;
- }
- -
- +
- if (t->valid_metadata())
- {
- if (index >= int(m_have_piece.size()))
- @@ -1589,8 +1593,8 @@ namespace libtorrent
- #endif
- m_peer_interested = true;
- if (is_disconnecting()) return;
- -
- - // if the peer is ready to download stuff, it must have metadata
- +
- + // if the peer is ready to download stuff, it must have metadata
- m_has_metadata = true;
- disconnect_if_redundant();
- @@ -1792,7 +1796,7 @@ namespace libtorrent
- m_have_piece.set_bit(index);
- ++m_num_pieces;
- - // if the peer is downloading stuff, it must have metadata
- + // if the peer is downloading stuff, it must have metadata
- m_has_metadata = true;
- // only update the piece_picker if
- @@ -1969,7 +1973,7 @@ namespace libtorrent
- }
- TORRENT_ASSERT(t->valid_metadata());
- -
- +
- int num_pieces = bits.count();
- if (num_pieces == int(m_have_piece.size()))
- {
- @@ -2364,9 +2368,9 @@ namespace libtorrent
- {
- check_postcondition(boost::shared_ptr<torrent> const& t_
- , bool init_check = true): t(t_) { if (init_check) check(); }
- -
- +
- ~check_postcondition() { check(); }
- -
- +
- void check()
- {
- if (!t->is_seed())
- @@ -2384,7 +2388,7 @@ namespace libtorrent
- }
- }
- }
- -
- +
- shared_ptr<torrent> t;
- };
- #endif
- @@ -2578,7 +2582,7 @@ namespace libtorrent
- TORRENT_ASSERT(int(m_download_queue.size()) > block_index);
- b = m_download_queue.begin() + block_index;
- TORRENT_ASSERT(*b == pending_b);
- -
- +
- #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
- TORRENT_ASSERT_VAL(m_received_in_piece == p.length, m_received_in_piece);
- m_received_in_piece = 0;
- @@ -2607,7 +2611,7 @@ namespace libtorrent
- send_block_requests();
- return;
- }
- -
- +
- if (total_seconds(now - m_requested)
- < m_ses.settings().request_timeout
- && m_snubbed)
- @@ -2754,7 +2758,7 @@ namespace libtorrent
- picker.mark_as_finished(block_finished, peer_info_struct());
- if (t->alerts().should_post<block_finished_alert>())
- {
- - t->alerts().post_alert(block_finished_alert(t->get_handle(),
- + t->alerts().post_alert(block_finished_alert(t->get_handle(),
- remote(), pid(), block_finished.block_index, block_finished.piece_index));
- }
- @@ -2880,7 +2884,7 @@ namespace libtorrent
- TORRENT_ASSERT(!m_have_piece.empty());
- m_have_piece.set_all();
- m_num_pieces = m_have_piece.size();
- -
- +
- t->peer_has_all();
- // if we're finished, we're not interested
- @@ -2889,7 +2893,7 @@ namespace libtorrent
- disconnect_if_redundant();
- }
- -
- +
- // -----------------------------
- // --------- HAVE NONE ---------
- // -----------------------------
- @@ -2916,7 +2920,7 @@ namespace libtorrent
- t->get_policy().set_seed(m_peer_info, false);
- m_bitfield_received = true;
- - // if the peer is ready to download stuff, it must have metadata
- + // if the peer is ready to download stuff, it must have metadata
- m_has_metadata = true;
- // we're never interested in a peer that doesn't have anything
- @@ -3004,7 +3008,7 @@ namespace libtorrent
- if (has_peer_choked() || !is_interesting()) return false;
- if ((int)m_download_queue.size() + (int)m_request_queue.size()
- > m_desired_queue_size * 2) return false;
- - if (on_parole()) return false;
- + if (on_parole()) return false;
- if (m_disconnecting) return false;
- boost::shared_ptr<torrent> t = m_torrent.lock();
- TORRENT_ASSERT(t);
- @@ -3100,7 +3104,7 @@ namespace libtorrent
- if (t->alerts().should_post<block_downloading_alert>())
- {
- - t->alerts().post_alert(block_downloading_alert(t->get_handle(),
- + t->alerts().post_alert(block_downloading_alert(t->get_handle(),
- remote(), pid(), speedmsg, block.block_index, block.piece_index));
- }
- @@ -3363,7 +3367,7 @@ namespace libtorrent
- if (has_piece(piece)
- || !m_peer_interested)
- return;
- -
- +
- #ifdef TORRENT_VERBOSE_LOGGING
- peer_log("==> SUGGEST [ %d ]", piece);
- #endif
- @@ -3373,7 +3377,7 @@ namespace libtorrent
- void peer_connection::send_block_requests()
- {
- INVARIANT_CHECK;
- -
- +
- boost::shared_ptr<torrent> t = m_torrent.lock();
- TORRENT_ASSERT(t);
- @@ -3448,7 +3452,7 @@ namespace libtorrent
- "piece: " << block.piece_index << " | "
- "block: " << block.block_index << " ]\n";
- #endif
- -*/
- +*/
- // if we are requesting large blocks, merge the smaller
- // blocks that are in the same piece into larger requests
- if (m_request_large_blocks)
- @@ -3490,7 +3494,7 @@ namespace libtorrent
- // the verification will fail for coalesced blocks
- TORRENT_ASSERT(verify_piece(r) || m_request_large_blocks);
- -
- +
- #ifndef TORRENT_DISABLE_EXTENSIONS
- bool handled = false;
- for (extension_list_t::iterator i = m_extensions.begin()
- @@ -3530,7 +3534,7 @@ namespace libtorrent
- connect_failed(errors::timed_out);
- }
- -
- +
- void peer_connection::connect_failed(error_code const& e)
- {
- TORRENT_ASSERT(e);
- @@ -3657,7 +3661,7 @@ namespace libtorrent
- if (ec == error_code(errors::timed_out)
- || ec == error::timed_out)
- ++m_ses.m_transport_timeout_peers;
- -
- +
- if (ec == error_code(errors::timed_out_inactivity)
- || ec == error_code(errors::timed_out_no_request)
- || ec == error_code(errors::timed_out_no_interest))
- @@ -3914,8 +3918,8 @@ namespace libtorrent
- p.download_queue_time = download_queue_time();
- p.queue_bytes = m_outstanding_bytes;
- -
- -#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
- +
- +#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
- p.country[0] = m_country[0];
- p.country[1] = m_country[1];
- #endif
- @@ -4006,7 +4010,7 @@ namespace libtorrent
- p.used_receive_buffer = m_recv_pos;
- p.write_state = m_channel_state[upload_channel];
- p.read_state = m_channel_state[download_channel];
- -
- +
- // pieces may be empty if we don't have metadata yet
- if (p.pieces.size() == 0)
- {
- @@ -4038,7 +4042,7 @@ namespace libtorrent
- bool peer_connection::allocate_disk_receive_buffer(int disk_buffer_size)
- {
- INVARIANT_CHECK;
- -
- +
- TORRENT_ASSERT(m_packet_size > 0);
- TORRENT_ASSERT(m_recv_pos <= m_packet_size - disk_buffer_size);
- TORRENT_ASSERT(!m_disk_recv_buffer);
- @@ -4071,7 +4075,7 @@ namespace libtorrent
- m_disk_recv_buffer_size = 0;
- return m_disk_recv_buffer.release();
- }
- -
- +
- // size = the packet size to remove from the receive buffer
- // packet_size = the next packet size to receive in the buffer
- void peer_connection::cut_receive_buffer(int size, int packet_size, int offset)
- @@ -4085,7 +4089,7 @@ namespace libtorrent
- TORRENT_ASSERT(offset >= 0);
- TORRENT_ASSERT(size >= 0);
- - if (size > 0)
- + if (size > 0)
- {
- if (m_recv_pos - size - offset > 0)
- std::memmove(&m_recv_buffer[0] + offset, &m_recv_buffer[0]
- @@ -4111,7 +4115,7 @@ namespace libtorrent
- {
- if (m_superseed_piece == -1) return;
- m_superseed_piece = -1;
- -
- +
- #ifdef TORRENT_VERBOSE_LOGGING
- peer_log("*** ending super seed mode");
- #endif
- @@ -4126,12 +4130,12 @@ namespace libtorrent
- #endif
- write_have(i);
- }
- -
- +
- return;
- }
- assert(!has_piece(index));
- -
- +
- #ifdef TORRENT_VERBOSE_LOGGING
- peer_log("==> HAVE [ piece: %d ] (super seed)", index);
- #endif
- @@ -4146,7 +4150,7 @@ namespace libtorrent
- m_desired_queue_size = 1;
- return;
- }
- -
- +
- int download_rate = statistics().download_rate();
- // calculate the desired download queue size
- @@ -4161,7 +4165,7 @@ namespace libtorrent
- const int block_size = t->block_size();
- TORRENT_ASSERT(block_size > 0);
- -
- +
- m_desired_queue_size = queue_time * download_rate / block_size;
- if (m_desired_queue_size > m_max_out_request_queue)
- @@ -4201,7 +4205,7 @@ namespace libtorrent
- upc = &m_ses.m_upload_channel;
- downc = &m_ses.m_download_channel;
- }
- -
- +
- int up_limit = m_bandwidth_channel[upload_channel].throttle();
- int down_limit = m_bandwidth_channel[download_channel].throttle();
- @@ -4400,7 +4404,7 @@ namespace libtorrent
- update_desired_queue_size();
- - if (m_desired_queue_size == m_max_out_request_queue
- + if (m_desired_queue_size == m_max_out_request_queue
- && t->alerts().should_post<performance_alert>())
- {
- t->alerts().post_alert(performance_alert(t->get_handle()
- @@ -4488,11 +4492,11 @@ namespace libtorrent
- if (now - m_remote_dl_update >= seconds(60))
- {
- if (m_remote_dl_rate > 0)
- - m_remote_dl_rate = (m_remote_dl_rate * 2 / 3) +
- + m_remote_dl_rate = (m_remote_dl_rate * 2 / 3) +
- ((m_remote_bytes_dled / 3) / 60);
- else
- m_remote_dl_rate = m_remote_bytes_dled / 60;
- -
- +
- m_remote_bytes_dled = 0;
- m_remote_dl_update = now;
- }
- @@ -4636,7 +4640,7 @@ namespace libtorrent
- // only add new piece-chunks if the send buffer is small enough
- // otherwise there will be no end to how large it will be!
- -
- +
- boost::uint64_t upload_rate = int(m_statistics.upload_rate());
- int buffer_size_watermark = upload_rate
- @@ -4656,7 +4660,7 @@ namespace libtorrent
- {
- TORRENT_ASSERT(t->ready_for_connections());
- peer_request& r = m_requests.front();
- -
- +
- TORRENT_ASSERT(r.piece >= 0);
- TORRENT_ASSERT(r.piece < (int)m_have_piece.size());
- TORRENT_ASSERT(t->have_piece(r.piece));
- @@ -4714,7 +4718,7 @@ namespace libtorrent
- disconnect(j.error);
- return;
- }
- -
- +
- if (ret != r.length)
- {
- if (ret == -3)
- @@ -4875,7 +4879,7 @@ namespace libtorrent
- if (m_disconnecting) return;
- if (m_channel_state[upload_channel] & (peer_info::bw_network | peer_info::bw_limit)) return;
- -
- +
- shared_ptr<torrent> t = m_torrent.lock();
- if (m_quota[upload_channel] == 0
- @@ -4995,7 +4999,7 @@ namespace libtorrent
- #ifdef TORRENT_VERBOSE_LOGGING
- peer_log(">>> CORKED WRITE [ bytes: %d ]", amount_to_send);
- #endif
- - return;
- + return;
- }
- TORRENT_ASSERT((m_channel_state[upload_channel] & peer_info::bw_network) == 0);
- @@ -5017,7 +5021,7 @@ namespace libtorrent
- {
- if ((m_channel_state[download_channel] & peer_info::bw_disk) == 0) return;
- boost::intrusive_ptr<peer_connection> me(this);
- -
- +
- m_ses.dec_disk_queue(download_channel);
- m_channel_state[download_channel] &= ~peer_info::bw_disk;
- setup_receive(read_async);
- @@ -5031,7 +5035,7 @@ namespace libtorrent
- if (m_channel_state[download_channel] & (peer_info::bw_network | peer_info::bw_limit)) return;
- shared_ptr<torrent> t = m_torrent.lock();
- -
- +
- if (m_quota[download_channel] == 0
- && !m_connecting)
- {
- @@ -5074,7 +5078,7 @@ namespace libtorrent
- peer_log(">>> ASSIGN BANDWIDTH [ bytes: %d ]", ret);
- #endif
- }
- -
- +
- if (!can_read(&m_channel_state[download_channel]))
- {
- #ifdef TORRENT_VERBOSE_LOGGING
- @@ -5397,7 +5401,7 @@ namespace libtorrent
- m_statistics.trancieve_ip_packet(bytes_in_loop, m_remote.address().is_v6());
- return;
- }
- -
- +
- TORRENT_ASSERT(m_packet_size > 0);
- TORRENT_ASSERT(bytes_transferred > 0);
- @@ -5523,7 +5527,7 @@ namespace libtorrent
- if (ticket == -1)
- {
- disconnect(asio::error::operation_aborted);
- - return;
- + return;
- }
- m_connection_ticket = ticket;
- @@ -5551,7 +5555,7 @@ namespace libtorrent
- }
- tcp::endpoint bind_interface = t->get_interface();
- -
- +
- std::pair<int, int> const& out_ports = m_ses.settings().outgoing_ports;
- if (out_ports.first > 0 && out_ports.second >= out_ports.first)
- {
- @@ -5611,7 +5615,7 @@ namespace libtorrent
- peer_log("*** LOCAL ENDPOINT[ e: %s ]", print_endpoint(m_socket->local_endpoint(ec)).c_str());
- #endif
- }
- -
- +
- void peer_connection::on_connection_complete(error_code const& e)
- {
- #if defined TORRENT_ASIO_DEBUGGING
- @@ -5631,7 +5635,7 @@ namespace libtorrent
- // assume 12 bits of entropy (i.e. about 8 milliseconds)
- RAND_add(&now, 8, 1.5);
- #endif
- -
- +
- if (m_disconnecting) return;
- error_code ec;
- @@ -5700,12 +5704,16 @@ namespace libtorrent
- peer_log(">>> SET_TOS[ tos: %d e: %s ]", m_ses.settings().peer_tos, ec.message().c_str());
- #endif
- }
- + else if (m_remote.address().is_v6())
- + {
- + m_socket->set_option(traffic_class(m_ses.settings().peer_tos), ec);
- + }
- on_connected();
- setup_send();
- setup_receive();
- }
- -
- +
- // --------------------------
- // SEND DATA
- // --------------------------
- @@ -5724,7 +5732,7 @@ namespace libtorrent
- #endif
- TORRENT_ASSERT(m_ses.is_network_thread());
- -#if defined TORRENT_VERBOSE_LOGGING
- +#if defined TORRENT_VERBOSE_LOGGING
- peer_log("*** ON_SEND_DATA [ bytes: %d error: %s ]"
- , int(bytes_transferred), error.message().c_str());
- #endif
- @@ -5749,7 +5757,7 @@ namespace libtorrent
- while (!m_requests_in_buffer.empty()
- && m_requests_in_buffer.front() <= 0)
- m_requests_in_buffer.erase(m_requests_in_buffer.begin());
- -
- +
- m_channel_state[upload_channel] &= ~peer_info::bw_network;
- TORRENT_ASSERT(int(bytes_transferred) <= m_quota[upload_channel]);
- @@ -6102,7 +6110,7 @@ namespace libtorrent
- time_duration d;
- d = time_now() - m_last_sent;
- if (total_seconds(d) < m_timeout / 2) return;
- -
- +
- if (m_connecting) return;
- if (in_handshake()) return;
- diff --git a/0.16.16/src/libtorrent-rasterbar-0.16.16/src/session_impl.cpp b/0.16.16/src/libtorrent-rasterbar-0.16.16/src/session_impl.cpp
- index 79cc500..6ec84ce 100644
- --- a/0.16.16/src/libtorrent-rasterbar-0.16.16/src/session_impl.cpp
- +++ b/0.16.16/src/libtorrent-rasterbar-0.16.16/src/session_impl.cpp
- @@ -481,7 +481,7 @@ namespace aux {
- #ifndef TORRENT_DISABLE_ENCRYPTION
- #define TORRENT_SETTING(t, x) {#x, offsetof(pe_settings,x), t},
- - bencode_map_entry pe_settings_map[] =
- + bencode_map_entry pe_settings_map[] =
- {
- TORRENT_SETTING(integer, out_enc_policy)
- TORRENT_SETTING(integer, in_enc_policy)
- @@ -554,7 +554,7 @@ namespace aux {
- {
- session_impl* ses = (session_impl*)arg;
- const char* servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
- -
- +
- if (!servername || strlen(servername) < 40)
- return SSL_TLSEXT_ERR_ALERT_FATAL;
- @@ -793,7 +793,7 @@ namespace aux {
- }
- else if (windows_version >= 0x050102)
- {
- - // on XP SP2 the limit is 10
- + // on XP SP2 the limit is 10
- m_half_open.limit(9);
- }
- else
- @@ -1141,7 +1141,7 @@ namespace aux {
- return;
- }
- m_last_log_rotation = time_now();
- -
- +
- fputs("second:uploaded bytes:downloaded bytes:downloading torrents:seeding torrents"
- ":peers:connecting peers:disk block buffers:num list peers"
- ":peer allocations:peer storage bytes"
- @@ -1439,7 +1439,7 @@ namespace aux {
- }
- #endif
- }
- -
- +
- void session_impl::set_proxy(proxy_settings const& s)
- {
- TORRENT_ASSERT(is_network_thread());
- @@ -1456,7 +1456,7 @@ namespace aux {
- TORRENT_ASSERT(is_network_thread());
- lazy_entry const* settings;
- -
- +
- if (e->type() != lazy_entry::dict_t) return;
- for (int i = 0; i < int(sizeof(all_settings)/sizeof(all_settings[0])); ++i)
- @@ -1466,7 +1466,7 @@ namespace aux {
- if (!settings) continue;
- load_struct(*settings, reinterpret_cast<char*>(this) + c.offset, c.map, c.num_entries);
- }
- -
- +
- update_rate_settings();
- update_connections_limit();
- update_unchoke_limit();
- @@ -1759,7 +1759,7 @@ namespace aux {
- if (t.should_check_files()) t.queue_torrent_check();
- }
- }
- -
- +
- void session_impl::abort()
- {
- TORRENT_ASSERT(is_network_thread());
- @@ -2052,7 +2052,10 @@ namespace aux {
- if (m_settings.peer_tos != s.peer_tos)
- {
- error_code ec;
- - m_udp_socket.set_option(type_of_service(s.peer_tos), ec);
- + if (m_udp_socket.local_endpoint(ec).address().is_v6())
- + m_udp_socket.set_option(traffic_class(s.peer_tos), ec);
- + else
- + m_udp_socket.set_option(type_of_service(s.peer_tos), ec);
- #if defined TORRENT_VERBOSE_LOGGING
- (*m_logger) << ">>> SET_TOS[ udp_socket tos: " << s.peer_tos << " e: " << ec.message() << " ]\n";
- #endif
- @@ -2071,7 +2074,7 @@ namespace aux {
- if (connections_limit_changed) update_connections_limit();
- if (unchoke_limit_changed) update_unchoke_limit();
- -
- +
- // enable anonymous mode. We don't want to accept any incoming
- // connections, except through a proxy.
- if (anonymous)
- @@ -2092,7 +2095,7 @@ namespace aux {
- m_listen_sockets.clear();
- }
- if (m_settings.connection_speed < 0) m_settings.connection_speed = 200;
- -
- +
- if (update_disk_io_thread)
- update_disk_thread_settings();
- @@ -2239,7 +2242,7 @@ namespace aux {
- << " external port: " << s->external_port << "\n";
- #endif
- }
- -
- +
- void session_impl::open_listen_port(int flags, error_code& ec)
- {
- TORRENT_ASSERT(is_network_thread());
- @@ -2265,12 +2268,12 @@ retry:
- tcp::endpoint ssl_interface = m_listen_interface;
- ssl_interface.port(m_settings.ssl_listen);
- #endif
- -
- +
- if (is_any(m_listen_interface.address()))
- {
- // this means we should open two listen sockets
- // one for IPv4 and one for IPv6
- -
- +
- listen_socket_t s;
- setup_listener(&s, tcp::endpoint(address_v4::any(), m_listen_interface.port())
- , m_listen_port_retries, false, flags, ec);
- @@ -2408,7 +2411,11 @@ retry:
- maybe_update_udp_mapping(1, m_listen_interface.port(), m_listen_interface.port());
- }
- - m_udp_socket.set_option(type_of_service(m_settings.peer_tos), ec);
- +
- + if (m_udp_socket.local_endpoint(ec).address().is_v6())
- + m_udp_socket.set_option(traffic_class(m_settings.peer_tos), ec);
- + else
- + m_udp_socket.set_option(type_of_service(m_settings.peer_tos), ec);
- #if defined TORRENT_VERBOSE_LOGGING
- (*m_logger) << ">>> SET_TOS[ udp_socket tos: " << m_settings.peer_tos << " e: " << ec.message() << " ]\n";
- #endif
- @@ -2463,7 +2470,7 @@ retry:
- && m_proxy.type != proxy_settings::socks5_pw
- && m_proxy.type != proxy_settings::socks4)
- return;
- -
- +
- if (m_socks_listen_socket) return;
- m_socks_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service));
- @@ -2610,7 +2617,7 @@ retry:
- return;
- }
- #endif
- -
- +
- if (m_utp_socket_manager.incoming_packet(buf, len, ep))
- return;
- @@ -2673,7 +2680,7 @@ retry:
- TORRENT_ASSERT(is_network_thread());
- boost::shared_ptr<socket_acceptor> listener = listen_socket.lock();
- if (!listener) return;
- -
- +
- if (e == asio::error::operation_aborted) return;
- if (m_abort) return;
- @@ -2756,9 +2763,9 @@ retry:
- #ifdef TORRENT_USE_OPENSSL
- // to test SSL connections, one can use this openssl command template:
- - //
- - // openssl s_client -cert <client-cert>.pem -key <client-private-key>.pem \
- - // -CAfile <torrent-cert>.pem -debug -connect 127.0.0.1:4433 -tls1 \
- + //
- + // openssl s_client -cert <client-cert>.pem -key <client-private-key>.pem \
- + // -CAfile <torrent-cert>.pem -debug -connect 127.0.0.1:4433 -tls1 \
- // -servername <hex-encoded-info-hash>
- void session_impl::ssl_handshake(error_code const& ec, boost::shared_ptr<socket_type> s)
- @@ -3050,7 +3057,7 @@ retry:
- std::pair<int, int> const& out_ports = m_settings.outgoing_ports;
- if (m_next_port < out_ports.first || m_next_port > out_ports.second)
- m_next_port = out_ports.first;
- -
- +
- int port = m_next_port;
- ++m_next_port;
- if (m_next_port > out_ports.second) m_next_port = out_ports.first;
- @@ -3357,7 +3364,7 @@ retry:
- // some people claim that there sometimes can be cases where
- // there is no torrent being checked, but there are torrents
- - // waiting to be checked. I have never seen this, and I can't
- + // waiting to be checked. I have never seen this, and I can't
- // see a way for it to happen. But, if it does, start one of
- // the queued torrents
- if (num_checking == 0 && num_queued > 0 && !m_paused)
- @@ -3419,7 +3426,7 @@ retry:
- m_peak_up_rate = (std::max)(m_stat.upload_rate(), m_peak_up_rate);
- m_peak_down_rate = (std::max)(m_stat.download_rate(), m_peak_down_rate);
- -
- +
- m_stat.second_tick(tick_interval_ms);
- TORRENT_ASSERT(least_recently_scraped == m_torrents.end()
- @@ -3647,7 +3654,7 @@ retry:
- torrent_map::iterator i = std::max_element(m_torrents.begin(), m_torrents.end()
- , boost::bind(&torrent::num_peers, boost::bind(&torrent_map::value_type::second, _1))
- < boost::bind(&torrent::num_peers, boost::bind(&torrent_map::value_type::second, _2)));
- -
- +
- TORRENT_ASSERT(i != m_torrents.end());
- int peers_to_disconnect = (std::min)((std::max)(
- int(i->second->num_peers() * m_settings.peer_turnover), 1)
- @@ -3680,7 +3687,7 @@ retry:
- }
- #ifdef TORRENT_STATS
- -
- +
- void session_impl::enable_stats_logging(bool s)
- {
- if (m_stats_logging_enabled == s) return;
- @@ -3868,7 +3875,7 @@ retry:
- ++peers_up_requests;
- if (p->endgame()) ++num_end_game_peers;
- reading_bytes += p->num_reading_bytes();
- -
- +
- pending_incoming_reqs += int(p->upload_queue().size());
- int dl_bucket = 0;
- @@ -4277,7 +4284,7 @@ retry:
- // if we count slow torrents, every torrent
- // is considered active
- if (!s.dont_count_slow_torrents) return true;
- -
- +
- // if the torrent started less than 2 minutes
- // ago (default), let it count as active since
- // the rates are probably not accurate yet
- @@ -4287,7 +4294,7 @@ retry:
- || t->statistics().download_payload_rate() != 0.f;
- }
- }
- -
- +
- void session_impl::auto_manage_torrents(std::vector<torrent*>& list
- , int& dht_limit, int& tracker_limit, int& lsd_limit
- , int& hard_limit, int type_limit)
- @@ -4364,7 +4371,7 @@ retry:
- lsd_limit = (std::numeric_limits<int>::max)();
- if (tracker_limit == -1)
- tracker_limit = (std::numeric_limits<int>::max)();
- -
- +
- for (torrent_map::iterator i = m_torrents.begin()
- , end(m_torrents.end()); i != end; ++i)
- {
- @@ -4435,14 +4442,14 @@ retry:
- auto_manage_torrents(seeds, dht_limit, tracker_limit, lsd_limit
- , hard_limit, num_seeds);
- }
- -
- +
- }
- void session_impl::recalculate_optimistic_unchoke_slots()
- {
- TORRENT_ASSERT(is_network_thread());
- if (m_allowed_upload_slots == 0) return;
- -
- +
- std::vector<policy::peer*> opt_unchoke;
- for (connection_map::iterator i = m_connections.begin()
- @@ -4524,7 +4531,7 @@ retry:
- pi->optimistically_unchoked = false;
- t->choke_peer(*pi->connection);
- --m_num_unchoked;
- - }
- + }
- }
- }
- }
- @@ -4662,7 +4669,7 @@ retry:
- if (m_settings.choking_algorithm == session_settings::auto_expand_choker
- && upload_limit > 0)
- {
- - // if our current upload rate is less than 90% of our
- + // if our current upload rate is less than 90% of our
- // limit AND most torrents are not "congested", i.e.
- // they are not holding back because of a per-torrent
- // limit
- @@ -4889,7 +4896,7 @@ retry:
- t->status(&*i, flags);
- }
- }
- -
- +
- void session_impl::post_torrent_updates()
- {
- INVARIANT_CHECK;
- @@ -4968,7 +4975,7 @@ retry:
- return torrent_handle();
- }
- -#ifndef TORRENT_DISABLE_DHT
- +#ifndef TORRENT_DISABLE_DHT
- // add p.dht_nodes to the DHT, if enabled
- if (m_dht && !p.dht_nodes.empty())
- {
- @@ -4985,7 +4992,7 @@ retry:
- ec = errors::session_is_closing;
- return torrent_handle();
- }
- -
- +
- // figure out the info hash of the torrent
- sha1_hash const* ih = 0;
- sha1_hash tmp;
- @@ -5828,10 +5835,10 @@ retry:
- int last_average = 0;
- int average = m_settings.connections_limit / m_torrents.size();
- -
- +
- // the number of slots that are unused by torrents
- int extra = m_settings.connections_limit % m_torrents.size();
- -
- +
- // run 3 iterations of this, then we're probably close enough
- for (int iter = 0; iter < 4; ++iter)
- {
- @@ -5886,7 +5893,7 @@ retry:
- {
- return m_alerts.get();
- }
- -
- +
- void session_impl::pop_alerts(std::deque<alert*>* alerts)
- {
- m_alerts.get_all(alerts);
- @@ -5920,7 +5927,7 @@ retry:
- , m_listen_interface.address()
- , boost::bind(&session_impl::on_lsd_peer, this, _1, _2));
- }
- -
- +
- natpmp* session_impl::start_natpmp()
- {
- INVARIANT_CHECK;
- @@ -5991,14 +5998,14 @@ retry:
- m_lsd->close();
- m_lsd = 0;
- }
- -
- +
- void session_impl::stop_natpmp()
- {
- if (m_natpmp.get())
- m_natpmp->close();
- m_natpmp = 0;
- }
- -
- +
- void session_impl::stop_upnp()
- {
- if (m_upnp.get())
- @@ -6012,7 +6019,7 @@ retry:
- }
- m_upnp = 0;
- }
- -
- +
- bool session_impl::external_ip_t::add_vote(sha1_hash const& k, int type)
- {
- sources |= type;
- @@ -6046,7 +6053,7 @@ retry:
- {
- // each IP only gets to add a new IP once
- if (m_external_address_voters.find(k)) return;
- -
- +
- if (m_external_addresses.size() > 20)
- {
- if (random() < UINT_MAX / 2)
- @@ -6080,7 +6087,7 @@ retry:
- }
- // add one more vote to this external IP
- if (!i->add_vote(k, source_type)) return;
- -
- +
- i = std::max_element(m_external_addresses.begin(), m_external_addresses.end());
- TORRENT_ASSERT(i != m_external_addresses.end());
- @@ -6131,7 +6138,7 @@ retry:
- {
- return m_disk_thread.allocate_buffer(category);
- }
- -
- +
- char* session_impl::allocate_buffer()
- {
- TORRENT_ASSERT(is_network_thread());
- @@ -6186,7 +6193,7 @@ retry:
- #else
- m_send_buffers.free(buf);
- #endif
- - }
- + }
- #ifdef TORRENT_DEBUG
- void session_impl::check_invariant() const
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement