relevance 4 | ../src/session_impl.cpp:663 | in order to support SSL over uTP, the utp_socket manager either needs to be able to receive packets on multiple ports, or we need to peek into the first few bytes the payload stream of a socket to determine whether or not it's an SSL connection. (The former is simpler but won't do as well with NATs) |
in order to support SSL over uTP, the utp_socket manager either
+needs to be able to receive packets on multiple ports, or we need to
+peek into the first few bytes the payload stream of a socket to determine
+whether or not it's an SSL connection. (The former is simpler but won't
+do as well with NATs)../src/session_impl.cpp:663 , m_disconnect_time_scaler(90)
+ , m_auto_scrape_time_scaler(180)
+ , m_next_explicit_cache_torrent(0)
+ , m_cache_rotation_timer(0)
+ , m_peak_up_rate(0)
+ , m_peak_down_rate(0)
+ , m_incoming_connection(false)
+ , m_created(time_now_hires())
+ , m_last_tick(m_created)
+ , m_last_second_tick(m_created - milliseconds(900))
+ , m_last_disk_performance_warning(min_time())
+ , m_last_disk_queue_performance_warning(min_time())
+ , m_last_choke(m_created)
+ , m_next_rss_update(min_time())
+#ifndef TORRENT_DISABLE_DHT
+ , m_dht_announce_timer(m_io_service)
+ , m_dht_interval_update_torrents(0)
+#endif
+ , m_external_udp_port(0)
+ , m_udp_socket(m_io_service, m_half_open)
+ , m_utp_socket_manager(m_settings, m_udp_socket
+ , boost::bind(&session_impl::incoming_connection, this, _1))
+ , m_boost_connections(0)
+ , m_timer(m_io_service)
+ , m_lsd_announce_timer(m_io_service)
+ , m_host_resolver(m_io_service)
+ , m_current_connect_attempts(0)
+ , m_tick_residual(0)
+ , m_non_filtered_torrents(0)
+#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
+ , m_logpath(".")
+#endif
+#ifndef TORRENT_DISABLE_GEO_IP
+ , m_asnum_db(0)
+ , m_country_db(0)
+#endif
+ , m_total_failed_bytes(0)
+ , m_total_redundant_bytes(0)
+ , m_pending_auto_manage(false)
+ , m_need_auto_manage(false)
+#if (defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS) && defined BOOST_HAS_PTHREADS
+ , m_network_thread(0)
+#endif
+ {
+#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
+ m_posting_torrent_updates = false;
#endif
- bool ret = instantiate_connection(m_ses.m_io_service, m_ses.proxy(), *s, userdata, sm, true);
- (void)ret;
- TORRENT_ASSERT(ret);
+ memset(m_redundant_bytes, 0, sizeof(m_redundant_bytes));
+ m_udp_socket.set_rate_limit(m_settings.dht_upload_rate_limit);
-#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700
- if (is_ssl_torrent())
- {
- // for ssl sockets, set the hostname
- std::string host_name = to_hex(m_torrent_file->info_hash().to_string());
-
-#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value: \
- s->get<ssl_stream<t> >()->set_host_name(host_name); break;
-
- switch (s->type())
- {
- CASE(stream_socket)
- CASE(socks5_stream)
- CASE(http_stream)
- CASE(utp_stream)
- default: break;
- };
- }
-#undef CASE
-#endif
- }
-
- m_ses.setup_socket_buffers(*s);
- | ||
relevance 3 | ../src/torrent.cpp:6151 | if peer is a really good peer, maybe we shouldn't disconnect it |
if peer is a really good peer, maybe we shouldn't disconnect it../src/torrent.cpp:6151 return false;
+ | ||
relevance 3 | ../src/torrent.cpp:6172 | if peer is a really good peer, maybe we shouldn't disconnect it |
if peer is a really good peer, maybe we shouldn't disconnect it../src/torrent.cpp:6172 return false;
}
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
m_connections.insert(p);
@@ -127,58 +131,7 @@
return m_connections.size() < m_max_connections
&& !is_paused()
&& ((m_state != torrent_status::checking_files
- | ||
relevance 3 | ../include/libtorrent/kademlia/dht_tracker.hpp:79 | take a udp_socket_interface here instead. Move udp_socket_interface down into libtorrent core |
take a udp_socket_interface here instead. Move udp_socket_interface down into libtorrent core../include/libtorrent/kademlia/dht_tracker.hpp:79 struct lazy_entry;
-}
-
-namespace libtorrent { namespace dht
-{
-
-#ifdef TORRENT_DHT_VERBOSE_LOGGING
- TORRENT_DECLARE_LOG(dht_tracker);
-#endif
-
- struct dht_tracker;
-
- TORRENT_EXTRA_EXPORT void intrusive_ptr_add_ref(dht_tracker const*);
- TORRENT_EXTRA_EXPORT void intrusive_ptr_release(dht_tracker const*);
-
- struct dht_tracker : udp_socket_interface, udp_socket_observer
- {
- friend void intrusive_ptr_add_ref(dht_tracker const*);
- friend void intrusive_ptr_release(dht_tracker const*);
-
- dht_tracker(libtorrent::aux::session_impl& ses, rate_limited_udp_socket& sock
- , dht_settings const& settings, entry const* state = 0);
- virtual ~dht_tracker();
-
- void start(entry const& bootstrap);
- void stop();
-
- void add_node(udp::endpoint node);
- void add_node(std::pair<std::string, int> const& node);
- void add_router_node(udp::endpoint const& node);
-
- entry state() const;
-
- void announce(sha1_hash const& ih, int listen_port, bool seed
- , boost::function<void(std::vector<tcp::endpoint> const&)> f);
-
- void dht_status(session_status& s);
- void network_stats(int& sent, int& received);
-
- // translate bittorrent kademlia message into the generic kademlia message
- // used by the library
- virtual bool incoming_packet(error_code const& ec
- , udp::endpoint const&, char const* buf, int size);
-
- private:
-
- boost::intrusive_ptr<dht_tracker> self()
- { return boost::intrusive_ptr<dht_tracker>(this); }
-
- void on_name_lookup(error_code const& e
- , udp::resolver::iterator host);
- | ||
relevance 3 | ../include/libtorrent/kademlia/find_data.hpp:60 | rename this class to find_peers, since that's what it does find_data is an unnecessarily generic name |
rename this class to find_peers, since that's what it does
+ | ||
relevance 3 | ../include/libtorrent/kademlia/find_data.hpp:60 | rename this class to find_peers, since that's what it does find_data is an unnecessarily generic name |
rename this class to find_peers, since that's what it does
find_data is an unnecessarily generic name../include/libtorrent/kademlia/find_data.hpp:60#include <libtorrent/kademlia/node_id.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>
@@ -214,177 +167,23 @@ public:
, nodes_callback const& ncallback
, bool noseeds);
- virtual char const* name() const { return "get_peers"; }
+ virtual void start();
+
+ virtual char const* name() const;
node_id const target() const { return m_target; }
protected:
- void done();
+ virtual void done();
observer_ptr new_observer(void* ptr, udp::endpoint const& ep, node_id const& id);
virtual bool invoke(observer_ptr o);
-private:
-
data_callback m_data_callback;
nodes_callback m_nodes_callback;
std::map<node_id, std::string> m_write_tokens;
node_id const m_target;
- | ||
relevance 2 | ../src/piece_picker.cpp:1489 | m_downloads size will be > 0 just by having pad-files in the torrent. That should be taken into account here. |
m_downloads size will be > 0 just by having pad-files
-in the torrent. That should be taken into account here.../src/piece_picker.cpp:1489 // have an affinity to pick pieces in the same speed
- // category.
- // * ignore_whole_pieces
- // ignores the prefer_whole_pieces parameter (as if
- // it was 0)
-
- // only one of rarest_first, sequential can be set
-
- void piece_picker::pick_pieces(bitfield const& pieces
- , std::vector<piece_block>& interesting_blocks, int num_blocks
- , int prefer_whole_pieces, void* peer, piece_state_t speed
- , int options, std::vector<int> const& suggested_pieces
- , int num_peers) const
- {
- TORRENT_ASSERT(peer == 0 || static_cast<policy::peer*>(peer)->in_use);
-
- // prevent the number of partial pieces to grow indefinitely
- // make this scale by the number of peers we have. For large
- // scale clients, we would have more peers, and allow a higher
- // threshold for the number of partials
- if (m_downloads.size() > num_peers * 3 / 2) options |= prioritize_partials;
-
- if (options & ignore_whole_pieces) prefer_whole_pieces = 0;
-
- // only one of rarest_first and sequential can be set.
- TORRENT_ASSERT(((options & rarest_first) ? 1 : 0)
- + ((options & sequential) ? 1 : 0) <= 1);
-#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
- TORRENT_PIECE_PICKER_INVARIANT_CHECK;
-#endif
- TORRENT_ASSERT(num_blocks > 0);
- TORRENT_ASSERT(pieces.size() == m_piece_map.size());
-
- TORRENT_ASSERT(!m_priority_boundries.empty()
- || m_dirty);
-
- // this will be filled with blocks that we should not request
- // unless we can't find num_blocks among the other ones.
- // blocks that belong to pieces with a mismatching speed
- // category for instance, or if we prefer whole pieces,
- // blocks belonging to a piece that others have
- // downloaded to
- std::vector<piece_block> backup_blocks;
- std::vector<piece_block> backup_blocks2;
- const std::vector<int> empty_vector;
-
- // When prefer_whole_pieces is set (usually set when downloading from
- // fast peers) the partial pieces will not be prioritized, but actually
- // ignored as long as possible. All blocks found in downloading
- // pieces are regarded as backup blocks
-
- | ||
relevance 2 | ../src/session_impl.cpp:5208 | if we still can't find the torrent, we should probably look for it by url here |
if we still can't find the torrent, we should probably look for it by url here../src/session_impl.cpp:5208 }
- }
-#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
- else
- {
- session_log("metadata info-hash failed");
- }
-#endif
- }
-#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
- else
- {
- session_log("no metadata found");
- }
-#endif
- }
-
- // is the torrent already active?
- boost::shared_ptr<torrent> torrent_ptr = find_torrent(*ih).lock();
- if (!torrent_ptr && !params.uuid.empty()) torrent_ptr = find_torrent(params.uuid).lock();
-
- if (torrent_ptr)
- {
- if ((params.flags & add_torrent_params::flag_duplicate_is_error) == 0)
- {
- if (!params.uuid.empty() && torrent_ptr->uuid().empty())
- torrent_ptr->set_uuid(params.uuid);
- if (!params.url.empty() && torrent_ptr->url().empty())
- torrent_ptr->set_url(params.url);
- if (!params.source_feed_url.empty() && torrent_ptr->source_feed_url().empty())
- torrent_ptr->set_source_feed_url(params.source_feed_url);
- return torrent_handle(torrent_ptr);
- }
-
- ec = errors::duplicate_torrent;
- return torrent_handle();
- }
-
- int queue_pos = 0;
- for (torrent_map::const_iterator i = m_torrents.begin()
- , end(m_torrents.end()); i != end; ++i)
- {
- int pos = i->second->queue_position();
- if (pos >= queue_pos) queue_pos = pos + 1;
- }
-
- torrent_ptr.reset(new torrent(*this, m_listen_interface
- , 16 * 1024, queue_pos, params, *ih));
- torrent_ptr->start();
-
-#ifndef TORRENT_DISABLE_EXTENSIONS
- | ||
relevance 2 | ../src/torrent.cpp:5919 | pass in ec along with the alert |
pass in ec along with the alert../src/torrent.cpp:5919
- if (info_hash != m_torrent_file->info_hash())
- {
- if (alerts().should_post<metadata_failed_alert>())
- {
- alerts().post_alert(metadata_failed_alert(get_handle()));
- }
- return false;
- }
-
- lazy_entry metadata;
- error_code ec;
- int ret = lazy_bdecode(metadata_buf, metadata_buf + metadata_size, metadata, ec);
- if (ret != 0 || !m_torrent_file->parse_info_section(metadata, ec, 0))
- {
- // this means the metadata is correct, since we
- // verified it against the info-hash, but we
- // failed to parse it. Pause the torrent
- if (alerts().should_post<metadata_failed_alert>())
- {
- alerts().post_alert(metadata_failed_alert(get_handle()));
- }
- set_error(errors::invalid_swarm_metadata, "");
- pause();
- return false;
- }
-
- if (m_ses.m_alerts.should_post<metadata_received_alert>())
- {
- m_ses.m_alerts.post_alert(metadata_received_alert(
- get_handle()));
- }
-
- // this makes the resume data "paused" and
- // "auto_managed" fields be ignored. If the paused
- // field is not ignored, the invariant check will fail
- // since we will be paused but without having disconnected
- // any of the peers.
- m_override_resume_data = true;
-
- // we have to initialize the torrent before we start
- // disconnecting redundant peers, otherwise we'll think
- // we're a seed, because we have all 0 pieces
- init();
-
- // disconnect redundant peers
- for (std::set<peer_connection*>::iterator i = m_connections.begin()
- , end(m_connections.end()); i != end;)
- {
- std::set<peer_connection*>::iterator p = i++;
- (*p)->disconnect_if_redundant();
- | ||
relevance 2 | ../src/torrent.cpp:8321 | will pick_pieces ever return an empty set? |
will pick_pieces ever return an empty set?../src/torrent.cpp:8321 if (added_request)
+ | ||
relevance 2 | ../src/torrent.cpp:8342 | will pick_pieces ever return an empty set? |
will pick_pieces ever return an empty set?../src/torrent.cpp:8342 if (added_request)
{
peers_with_requests.insert(peers_with_requests.begin(), &c);
if (i->first_requested == min_time()) i->first_requested = now;
@@ -435,67 +234,16 @@ in the torrent. That should be taken into account here.../src/piece_pic
void torrent::remove_web_seed(std::string const& url, web_seed_entry::type_t type)
{
std::list<web_seed_entry>::iterator i = std::find_if(m_web_seeds.begin(), m_web_seeds.end()
- | ||
relevance 2 | ../src/utp_stream.cpp:608 | support the option to turn it off |
support the option to turn it off../src/utp_stream.cpp:608 UTP_STATE_ERROR_WAIT,
-
- // there are no more references to this socket
- // and we can delete it
- UTP_STATE_DELETE
- };
-
- // this is the cursor into m_delay_sample_hist
- boost::uint8_t m_delay_sample_idx:2;
-
- // the state the socket is in
- boost::uint8_t m_state:3;
-
- // this is set to true when we receive a fin
- bool m_eof:1;
-
- // is this socket state attached to a user space socket?
- bool m_attached:1;
-
- // this is true if nagle is enabled (which it is by default)
- bool m_nagle:1;
-
- // this is true while the socket is in slow start mode. It's
- // only in slow-start during the start-up phase. Slow start
- // (contrary to what its name suggest) means that we're growing
- // the congestion window (cwnd) exponetially rather than linearly.
- // this is done at startup of a socket in order to find its
- // link capacity faster. This behaves similar to TCP slow start
- bool m_slow_start:1;
-
- // this is true as long as we have as many packets in
- // flight as allowed by the congestion window (cwnd)
- bool m_cwnd_full:1;
-
- // this is set to true when this socket has added itself to
- // the utp socket manager's list of deferred acks. Once the
- // burst of incoming UDP packets is all drained, the utp socket
- // manager will send acks for all sockets on this list.
- bool m_deferred_ack:1;
-
- // this is true if this socket has subscribed to be notified
- // when this receive round is done
- bool m_subscribe_drained:1;
-
- // if this socket tries to send a packet via the utp socket
- // manager, and it fails with EWOULDBLOCK, the socket
- // is stalled and this is set. It's also added to a list
- // of sockets in the utp_socket_manager to be notified of
- // the socket being writable again
- bool m_stalled:1;
-};
- | ||
relevance 2 | ../src/utp_stream.cpp:1862 | we might want to do something else here as well, to resend the packet immediately without it being an MTU probe |
we might want to do something else here
+ | ||
relevance 2 | ../src/utp_stream.cpp:1862 | we might want to do something else here as well, to resend the packet immediately without it being an MTU probe |
we might want to do something else here
as well, to resend the packet immediately without
-it being an MTU probe../src/utp_stream.cpp:1862 // simulate 1% packet loss
-// if ((rand() % 100) > 0)
+it being an MTU probe../src/utp_stream.cpp:1862// if ((rand() % 100) > 0)
#endif
m_sm->send_packet(udp::endpoint(m_remote_address, m_port)
, (char const*)h, p->size, ec
, p->mtu_probe ? utp_socket_manager::dont_fragment : 0);
++m_out_packets;
+ m_sm->inc_stats_counter(utp_socket_manager::packets_out);
if (ec == error::message_size)
{
@@ -539,51 +287,59 @@ it being an MTU probe../src/utp_stream.cpp:1862relevance 2 | ../src/kademlia/dht_tracker.cpp:641 | fix this stats logging. For instance, the stats counters could be factored out into its own class, and dht_tracker could take an optional reference to it ++m_replies_sent[e["r"]]; m_replies_bytes_sent[e["r"]] += int(m_send_buf.size()); |
|
fix this stats logging. For instance,
-the stats counters could be factored out into its own
-class, and dht_tracker could take an optional reference to it
-++m_replies_sent[e["r"]];
-m_replies_bytes_sent[e["r"]] += int(m_send_buf.size());../src/kademlia/dht_tracker.cpp:641#ifdef TORRENT_DHT_VERBOSE_LOGGING
- std::stringstream log_line;
- lazy_entry print;
- int ret = lazy_bdecode(&m_send_buf[0], &m_send_buf[0] + m_send_buf.size(), print, ec);
- TORRENT_ASSERT(ret == 0);
- log_line << print_entry(print, true);
-#endif
+ | ||
relevance 2 | ../src/utp_stream.cpp:2493 | sequence number, source IP and connection ID should be verified before accepting a reset packet |
sequence number, source IP and connection ID should be
+verified before accepting a reset packet../src/utp_stream.cpp:2493 m_reply_micro = boost::uint32_t(total_microseconds(receive_time - min_time()))
+ - ph->timestamp_microseconds;
+ boost::uint32_t prev_base = m_their_delay_hist.initialized() ? m_their_delay_hist.base() : 0;
+ their_delay = m_their_delay_hist.add_sample(m_reply_micro, step);
+ int base_change = m_their_delay_hist.base() - prev_base;
+ UTP_LOGV("%8p: their_delay::add_sample:%u prev_base:%u new_base:%u\n"
+ , this, m_reply_micro, prev_base, m_their_delay_hist.base());
- if (m_sock.send(addr, &m_send_buf[0], (int)m_send_buf.size(), ec, send_flags))
+ if (prev_base && base_change < 0 && base_change > -10000 && m_delay_hist.initialized())
{
- if (ec) return false;
-
- // account for IP and UDP overhead
- m_sent_bytes += m_send_buf.size() + (addr.address().is_v6() ? 48 : 28);
-
-#ifdef TORRENT_DHT_VERBOSE_LOGGING
- m_total_out_bytes += m_send_buf.size();
-
- if (e["y"].string() == "r")
- {
- }
- else if (e["y"].string() == "q")
- {
- m_queries_out_bytes += m_send_buf.size();
- }
- TORRENT_LOG(dht_tracker) << "==> " << addr << " " << log_line.str();
-#endif
- return true;
- }
- else
- {
-#ifdef TORRENT_DHT_VERBOSE_LOGGING
- TORRENT_LOG(dht_tracker) << "==> " << addr << " DROPPED " << log_line.str();
-#endif
- return false;
+ // their base delay went down. This is caused by clock drift. To compensate,
+ // adjust our base delay upwards
+ // don't adjust more than 10 ms. If the change is that big, something is probably wrong
+ m_delay_hist.adjust_base(-base_change);
}
+
+ UTP_LOGV("%8p: incoming packet reply_micro:%u base_change:%d\n"
+ , this, m_reply_micro, prev_base ? base_change : 0);
}
-}}
+ if (ph->get_type() == ST_RESET)
+ {
+ UTP_LOGV("%8p: incoming packet type:RESET\n", this);
+ m_error = asio::error::connection_reset;
+ m_state = UTP_STATE_ERROR_WAIT;
+ test_socket_state();
+ return true;
+ }
- | ||
relevance 2 | ../src/kademlia/node.cpp:64 | make this configurable in dht_settings |
make this configurable in dht_settings../src/kademlia/node.cpp:64#include "libtorrent/socket.hpp"
+ // is this ACK valid? If the other end is ACKing
+ // a packet that hasn't been sent yet
+ // just ignore it. A 3rd party could easily inject a packet
+ // like this in a stream, don't sever it because of it.
+ // since m_seq_nr is the sequence number of the next packet
+ // we'll send (and m_seq_nr-1 was the last packet we sent),
+ // if the ACK we got is greater than the last packet we sent
+ // something is wrong.
+ // If our state is state_none, this packet must be a syn packet
+ // and the ack_nr should be ignored
+ boost::uint16_t cmp_seq_nr = (m_seq_nr - 1) & ACK_MASK;
+#if TORRENT_UT_SEQ
+ if (m_state == UTP_STATE_SYN_SENT && ph->get_type() == ST_STATE)
+ cmp_seq_nr = m_seq_nr;
+#endif
+ if (m_state != UTP_STATE_NONE
+ && compare_less_wrap(cmp_seq_nr, ph->ack_nr, ACK_MASK))
+ {
+ UTP_LOGV("%8p: incoming packet ack_nr:%d our seq_nr:%d (ignored)\n"
+ , this, int(ph->ack_nr), m_seq_nr);
+ m_sm->inc_stats_counter(utp_socket_manager::redundant_pkts_in);
+ return true;
+ | ||
relevance 2 | ../src/kademlia/node.cpp:64 | make this configurable in dht_settings |
make this configurable in dht_settings../src/kademlia/node.cpp:64#include "libtorrent/socket.hpp"
#include "libtorrent/random.hpp"
#include "libtorrent/aux_/session_impl.hpp"
#include "libtorrent/kademlia/node_id.hpp"
@@ -599,7 +355,7 @@ m_replies_bytes_sent[e["r"]] += int(m_send_buf.size());../src/kademlia/
namespace libtorrent { namespace dht
{
-void incoming_error(entry& e, char const* msg);
+void incoming_error(entry& e, char const* msg, int error_code = 203);
using detail::write_endpoint;
@@ -634,160 +390,7 @@ void purge_peers(std::set<peer_entry>& peers)
void nop() {}
- | ||
relevance 2 | ../include/libtorrent/natpmp.hpp:56 | make this a shared_ptr instead |
make this a shared_ptr instead../include/libtorrent/natpmp.hpp:56#include "libtorrent/io_service_fwd.hpp"
-#include "libtorrent/socket.hpp"
-#include "libtorrent/address.hpp"
-#include "libtorrent/thread.hpp"
-#include "libtorrent/error_code.hpp"
-#include "libtorrent/intrusive_ptr_base.hpp"
-#include "libtorrent/deadline_timer.hpp"
-
-#include <boost/function/function1.hpp>
-#include <boost/function/function4.hpp>
-
-namespace libtorrent
-{
-
-// int: port mapping index
-// int: external port
-// std::string: error message
-typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t;
-typedef boost::function<void(char const*)> log_callback_t;
-
-class natpmp : public intrusive_ptr_base<natpmp>
- {
-public:
- natpmp(io_service& ios, address const& listen_interface
- , portmap_callback_t const& cb
- , log_callback_t const& lcb);
-
- void rebind(address const& listen_interface);
-
- // maps the ports, if a port is set to 0
- // it will not be mapped
- enum protocol_type { none = 0, udp = 1, tcp = 2 };
- int add_mapping(protocol_type p, int external_port, int local_port);
- void delete_mapping(int mapping_index);
- bool get_mapping(int mapping_index, int& local_port, int& external_port, int& protocol) const;
-
- void close();
-
-private:
-
- void update_mapping(int i, mutex::scoped_lock& l);
- void send_map_request(int i, mutex::scoped_lock& l);
- void send_get_ip_address_request(mutex::scoped_lock& l);
- void resend_request(int i, error_code const& e);
- void on_reply(error_code const& e
- , std::size_t bytes_transferred);
- void try_next_mapping(int i, mutex::scoped_lock& l);
- void update_expiration_timer(mutex::scoped_lock& l);
- void mapping_expired(error_code const& e, int i);
- void close_impl(mutex::scoped_lock& l);
-
- | ||
relevance 2 | ../include/libtorrent/torrent_info.hpp:663 | these strings (m_comment, m_created_by, m_ssl_root_cert) could be lazy_entry* to save memory |
these strings (m_comment, m_created_by, m_ssl_root_cert) could be lazy_entry* to save memory../include/libtorrent/torrent_info.hpp:663 std::vector<announce_entry> m_urls;
- std::vector<web_seed_entry> m_web_seeds;
- nodes_t m_nodes;
-
- // if this is a merkle torrent, this is the merkle
- // tree. It has space for merkle_num_nodes(merkle_num_leafs(num_pieces))
- // hashes
- std::vector<sha1_hash> m_merkle_tree;
-
- // this is a copy of the info section from the torrent.
- // it use maintained in this flat format in order to
- // make it available through the metadata extension
- boost::shared_array<char> m_info_section;
-
- // this is a pointer into the m_info_section buffer
- // pointing to the first byte of the first sha-1 hash
- char const* m_piece_hashes;
-
- // if a comment is found in the torrent file
- // this will be set to that comment
- std::string m_comment;
-
- // an optional string naming the software used
- // to create the torrent file
- std::string m_created_by;
-
-#ifdef TORRENT_USE_OPENSSL
- // for ssl-torrens, this contains the root
- // certificate, in .pem format (i.e. ascii
- // base64 encoded with head and tails)
- std::string m_ssl_root_cert;
-#endif
-
- // the info section parsed. points into m_info_section
- // parsed lazily
- mutable lazy_entry m_info_dict;
-
- // if a creation date is found in the torrent file
- // this will be set to that, otherwise it'll be
- // 1970, Jan 1
- time_t m_creation_date;
-
- // the hash that identifies this torrent
- sha1_hash m_info_hash;
-
- // the number of bytes in m_info_section
- boost::uint32_t m_info_section_size:24;
-
- // this is used when creating a torrent. If there's
- // only one file there are cases where it's impossible
- // to know if it should be written as a multifile torrent
- | ||
relevance 2 | ../include/libtorrent/upnp.hpp:122 | make this a shared_ptr instead |
make this a shared_ptr instead../include/libtorrent/upnp.hpp:122 virtual const char* name() const;
- virtual std::string message(int ev) const;
- virtual boost::system::error_condition default_error_condition(int ev) const
- { return boost::system::error_condition(ev, *this); }
- };
-
- extern TORRENT_EXPORT upnp_error_category upnp_category;
-#endif
-
-// int: port-mapping index
-// address: external address as queried from router
-// int: external port
-// std::string: error message
-// an empty string as error means success
-// a port-mapping index of -1 means it's
-// an informational log message
-typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t;
-typedef boost::function<void(char const*)> log_callback_t;
-
-class TORRENT_EXTRA_EXPORT upnp : public intrusive_ptr_base<upnp>
-{
- public:
- upnp(io_service& ios, connection_queue& cc
- , address const& listen_interface, std::string const& user_agent
- , portmap_callback_t const& cb, log_callback_t const& lcb
- , bool ignore_nonrouters, void* state = 0);
- ~upnp();
-
- void* drain_state();
-
- enum protocol_type { none = 0, udp = 1, tcp = 2 };
-
- // Attempts to add a port mapping for the specified protocol. Valid protocols are
- // ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and
- // ``natpmp::udp`` for the NAT-PMP class.
- //
- // ``external_port`` is the port on the external address that will be mapped. This
- // is a hint, you are not guaranteed that this port will be available, and it may
- // end up being something else. In the portmap_alert_ notification, the actual
- // external port is reported.
- //
- // ``local_port`` is the port in the local machine that the mapping should forward
- // to.
- //
- // The return value is an index that identifies this port mapping. This is used
- // to refer to mappings that fails or succeeds in the portmap_error_alert_ and
- // portmap_alert_ respectively. If The mapping fails immediately, the return value
- // is -1, which means failure. There will not be any error alert notification for
- // mappings that fail with a -1 return value.
- int add_mapping(protocol_type p, int external_port, int local_port);
-
- | ||
relevance 1 | ../src/http_seed_connection.cpp:120 | in chunked encoding mode, this assert won't hold. the chunk headers should be subtracted from the receive_buffer_size |
in chunked encoding mode, this assert won't hold.
+ | ||
relevance 1 | ../src/http_seed_connection.cpp:120 | in chunked encoding mode, this assert won't hold. the chunk headers should be subtracted from the receive_buffer_size |
in chunked encoding mode, this assert won't hold.
the chunk headers should be subtracted from the receive_buffer_size../src/http_seed_connection.cpp:120 boost::optional<piece_block_progress>
http_seed_connection::downloading_piece_progress() const
{
@@ -839,7 +442,7 @@ the chunk headers should be subtracted from the receive_buffer_size../s
std::string request;
request.reserve(400);
- | ||
relevance 1 | ../src/peer_connection.cpp:2568 | peers should really be corked/uncorked outside of all completed disk operations |
peers should really be corked/uncorked outside of
+ | ||
relevance 1 | ../src/peer_connection.cpp:2568 | peers should really be corked/uncorked outside of all completed disk operations |
peers should really be corked/uncorked outside of
all completed disk operations../src/peer_connection.cpp:2568 }
if (is_disconnecting()) return;
@@ -891,8 +494,8 @@ all completed disk operations../src/peer_connection.cpp:2568 | ||
relevance 1 | ../src/session_impl.cpp:5579 | report the proper address of the router as the source IP of this understanding of our external address, instead of the empty address |
report the proper address of the router as the source IP of
-this understanding of our external address, instead of the empty address../src/session_impl.cpp:5579 void session_impl::on_port_mapping(int mapping, address const& ip, int port
+ | ||
relevance 1 | ../src/session_impl.cpp:5669 | report the proper address of the router as the source IP of this understanding of our external address, instead of the empty address |
report the proper address of the router as the source IP of
+this understanding of our external address, instead of the empty address../src/session_impl.cpp:5669 void session_impl::on_port_mapping(int mapping, address const& ip, int port
, error_code const& ec, int map_transport)
{
TORRENT_ASSERT(is_network_thread());
@@ -943,7 +546,7 @@ this understanding of our external address, instead of the empty address | ||
relevance 1 | ../src/session_impl.cpp:5789 | report errors as alerts |
report errors as alerts../src/session_impl.cpp:5789 }
+ | ||
relevance 1 | ../src/session_impl.cpp:5879 | report errors as alerts |
report errors as alerts../src/session_impl.cpp:5879 }
void session_impl::add_dht_router(std::pair<std::string, int> const& node)
{
@@ -994,9 +597,9 @@ this understanding of our external address, instead of the empty address | ||
relevance 1 | ../src/session_impl.cpp:6258 | we only need to do this if our global IPv4 address has changed since the DHT (currently) only supports IPv4. Since restarting the DHT is kind of expensive, it would be nice to not do it unnecessarily |
we only need to do this if our global IPv4 address has changed
+ | ||
relevance 1 | ../src/session_impl.cpp:6348 | we only need to do this if our global IPv4 address has changed since the DHT (currently) only supports IPv4. Since restarting the DHT is kind of expensive, it would be nice to not do it unnecessarily |
we only need to do this if our global IPv4 address has changed
since the DHT (currently) only supports IPv4. Since restarting the DHT
-is kind of expensive, it would be nice to not do it unnecessarily../src/session_impl.cpp:6258 void session_impl::set_external_address(address const& ip
+is kind of expensive, it would be nice to not do it unnecessarily../src/session_impl.cpp:6348 void session_impl::set_external_address(address const& ip
, int source_type, address const& source)
{
#if defined TORRENT_VERBOSE_LOGGING
@@ -1047,11 +650,11 @@ is kind of expensive, it would be nice to not do it unnecessarily../src
#ifdef TORRENT_DISK_STATS
TORRENT_ASSERT(m_buffer_allocations >= 0);
- | ||
relevance 1 | ../src/torrent.cpp:1169 | make this depend on the error and on the filesystem the files are being downloaded to. If the error is no_space_left_on_device and the filesystem doesn't support sparse files, only zero the priorities of the pieces that are at the tails of all files, leaving everything up to the highest written piece in each file |
make this depend on the error and on the filesystem the
+ | ||
relevance 1 | ../src/torrent.cpp:1161 | make this depend on the error and on the filesystem the files are being downloaded to. If the error is no_space_left_on_device and the filesystem doesn't support sparse files, only zero the priorities of the pieces that are at the tails of all files, leaving everything up to the highest written piece in each file |
make this depend on the error and on the filesystem the
files are being downloaded to. If the error is no_space_left_on_device
and the filesystem doesn't support sparse files, only zero the priorities
of the pieces that are at the tails of all files, leaving everything
-up to the highest written piece in each file../src/torrent.cpp:1169 if (c) c->disconnect(errors::no_memory);
+up to the highest written piece in each file../src/torrent.cpp:1161 if (c) c->disconnect(errors::no_memory);
return;
}
@@ -1102,8 +705,8 @@ up to the highest written piece in each file../src/torrent.cpp:1169 | ||
relevance 1 | ../src/torrent.cpp:5422 | save the send_stats state instead of throwing them away it may pose an issue when downgrading though |
save the send_stats state instead of throwing them away
-it may pose an issue when downgrading though../src/torrent.cpp:5422 ? (1 << k) : 0;
+ | ||
relevance 1 | ../src/torrent.cpp:5434 | save the send_stats state instead of throwing them away it may pose an issue when downgrading though |
save the send_stats state instead of throwing them away
+it may pose an issue when downgrading though../src/torrent.cpp:5434 ? (1 << k) : 0;
bitmask.append(1, v);
TORRENT_ASSERT(bits == 8 || j == num_bitmask_bytes - 1);
}
@@ -1154,61 +757,9 @@ it may pose an issue when downgrading though../src/torrent.cpp:5422 | ||
relevance 1 | ../src/torrent.cpp:6077 | ideally, we would disconnect the oldest connection i.e. the one that has waited the longest to connect. |
ideally, we would disconnect the oldest connection
-i.e. the one that has waited the longest to connect.../src/torrent.cpp:6077 if (m_ses.is_aborted())
- {
- p->disconnect(errors::session_closing);
- return false;
- }
-
- bool maybe_replace_peer = false;
-
- if (m_connections.size() >= m_max_connections)
- {
- // if more than 10% of the connections are outgoing
- // connection attempts that haven't completed yet,
- // disconnect one of them and let this incoming
- // connection through.
- if (m_num_connecting > m_max_connections / 10)
- {
- // find one of the connecting peers and disconnect it
- // find any peer that's connecting (i.e. a half-open TCP connection)
- // that's also not disconnecting
-
- std::set<peer_connection*>::iterator i = std::find_if(begin(), end()
- , boost::bind(&peer_connection::is_connecting, _1)
- && !boost::bind(&peer_connection::is_disconnecting, _1));
-
- if (i == end())
- {
- // this seems odd, but we might as well handle it
- p->disconnect(errors::too_many_connections);
- return false;
- }
- (*i)->disconnect(errors::too_many_connections);
-
- // if this peer was let in via connections slack,
- // it has done its duty of causing the disconnection
- // of another peer
- p->peer_disconnected_other();
- }
- else
- {
- maybe_replace_peer = true;
- }
- }
-
- TORRENT_TRY
- {
-#ifndef TORRENT_DISABLE_EXTENSIONS
- for (extension_list_t::iterator i = m_extensions.begin()
- , end(m_extensions.end()); i != end; ++i)
- {
- boost::shared_ptr<peer_plugin> pp((*i)->new_connection(p));
- if (pp) p->add_extension(pp);
- | ||
relevance 1 | ../src/torrent.cpp:6318 | should disconnect all peers that have the pieces we have not just seeds. It would be pretty expensive to check all pieces for all peers though |
should disconnect all peers that have the pieces we have
+ | ||
relevance 1 | ../src/torrent.cpp:6339 | should disconnect all peers that have the pieces we have not just seeds. It would be pretty expensive to check all pieces for all peers though |
should disconnect all peers that have the pieces we have
not just seeds. It would be pretty expensive to check all pieces
-for all peers though../src/torrent.cpp:6318 TORRENT_ASSERT(is_finished());
+for all peers though../src/torrent.cpp:6339 TORRENT_ASSERT(is_finished());
TORRENT_ASSERT(m_state != torrent_status::finished && m_state != torrent_status::seeding);
set_state(torrent_status::finished);
@@ -1259,7 +810,7 @@ for all peers though../src/torrent.cpp:6318relevance 1 | ../src/torrent_info.cpp:181 | we might save constructing a std::string if this would take a char const* instead |
|
we might save constructing a std::string if this would take a char const* instead../src/torrent_info.cpp:181 {
+ | ||
relevance 1 | ../src/torrent_info.cpp:181 | we might save constructing a std::string if this would take a char const* instead |
we might save constructing a std::string if this would take a char const* instead../src/torrent_info.cpp:181 {
tmp_path += i[0];
tmp_path += i[1];
tmp_path += i[2];
@@ -1310,7 +861,7 @@ for all peers though../src/torrent.cpp:6318relevance 1 | ../src/torrent_info.cpp:385 | this logic should be a separate step done once the torrent is loaded, and the original filenames should be preserved! |
|
this logic should be a separate step
+ | ||
relevance 1 | ../src/torrent_info.cpp:385 | this logic should be a separate step done once the torrent is loaded, and the original filenames should be preserved! |
this logic should be a separate step
done once the torrent is loaded, and the original
filenames should be preserved!../src/torrent_info.cpp:385
while (*s1 != 0 || *s2 != 0)
@@ -1360,7 +911,7 @@ filenames should be preserved!../src/torrent_info.cpp:385 | ||
relevance 1 | ../src/torrent_info.cpp:416 | once the filename renaming is removed from here this check can be removed as well |
once the filename renaming is removed from here
+ | ||
relevance 1 | ../src/torrent_info.cpp:416 | once the filename renaming is removed from here this check can be removed as well |
once the filename renaming is removed from here
this check can be removed as well../src/torrent_info.cpp:416 if (!extract_single_file(*list.list_at(i), e, root_dir
, &file_hash, &fee, &mtime))
return false;
@@ -1412,7 +963,7 @@ this check can be removed as well../src/torrent_info.cpp:416 | ||
relevance 1 | ../src/kademlia/node.cpp:700 | find_node should write directly to the response entry |
find_node should write directly to the response entry../src/kademlia/node.cpp:700 {
+ | ||
relevance 1 | ../src/kademlia/node.cpp:739 | find_node should write directly to the response entry |
find_node should write directly to the response entry../src/kademlia/node.cpp:739 {
TORRENT_LOG(node) << " values: " << reply["values"].list().size();
}
#endif
@@ -1463,7 +1014,7 @@ this check can be removed as well../src/torrent_info.cpp:416 | ||
relevance 1 | ../include/libtorrent/ip_voter.hpp:100 | instead, have one instance per possible subnet, global IPv4, global IPv6, loopback, 192.168.x.x, 10.x.x.x, etc. |
instead, have one instance per possible subnet, global IPv4, global IPv6, loopback, 192.168.x.x, 10.x.x.x, etc.../include/libtorrent/ip_voter.hpp:100 bloom_filter<32> m_external_address_voters;
+ | ||
relevance 1 | ../include/libtorrent/ip_voter.hpp:100 | instead, have one instance per possible subnet, global IPv4, global IPv6, loopback, 192.168.x.x, 10.x.x.x, etc. |
instead, have one instance per possible subnet, global IPv4, global IPv6, loopback, 192.168.x.x, 10.x.x.x, etc.../include/libtorrent/ip_voter.hpp:100 bloom_filter<32> m_external_address_voters;
std::vector<external_ip_t> m_external_addresses;
address m_external_address;
};
@@ -1490,7 +1041,7 @@ this check can be removed as well../src/torrent_info.cpp:416 | ||
relevance 1 | ../include/libtorrent/utp_stream.hpp:351 | implement blocking write. Low priority since it's not used (yet) |
implement blocking write. Low priority since it's not used (yet)../include/libtorrent/utp_stream.hpp:351 for (typename Mutable_Buffers::const_iterator i = buffers.begin()
+ | ||
relevance 1 | ../include/libtorrent/utp_stream.hpp:376 | implement blocking write. Low priority since it's not used (yet) |
implement blocking write. Low priority since it's not used (yet)../include/libtorrent/utp_stream.hpp:376 for (typename Mutable_Buffers::const_iterator i = buffers.begin()
, end(buffers.end()); i != end; ++i)
{
using asio::buffer_cast;
@@ -1535,13 +1086,13 @@ this check can be removed as well../src/torrent_info.cpp:416 | ||
relevance 1 | ../include/libtorrent/web_peer_connection.hpp:127 | if we make this be a disk_buffer_holder instead we would save a copy sometimes use allocate_disk_receive_buffer and release_disk_receive_buffer |
if we make this be a disk_buffer_holder instead
+ TORRENT_ASSERT(false);
+ }
+
+ | ||
relevance 1 | ../include/libtorrent/web_peer_connection.hpp:127 | if we make this be a disk_buffer_holder instead we would save a copy sometimes use allocate_disk_receive_buffer and release_disk_receive_buffer |
if we make this be a disk_buffer_holder instead
we would save a copy sometimes
use allocate_disk_receive_buffer and release_disk_receive_buffer../include/libtorrent/web_peer_connection.hpp:127
private:
@@ -1592,7 +1143,7 @@ use allocate_disk_receive_buffer and release_disk_receive_buffer../incl
#endif // TORRENT_WEB_PEER_CONNECTION_HPP_INCLUDED
- | ||
relevance 0 | ../src/bt_peer_connection.cpp:655 | this could be optimized using knuth morris pratt |
this could be optimized using knuth morris pratt../src/bt_peer_connection.cpp:655 if (m_encrypted && m_rc4_encrypted)
+ | ||
relevance 0 | ../src/bt_peer_connection.cpp:655 | this could be optimized using knuth morris pratt |
this could be optimized using knuth morris pratt../src/bt_peer_connection.cpp:655 if (m_encrypted && m_rc4_encrypted)
{
fun = encrypt;
userdata = m_enc_handler.get();
@@ -1643,58 +1194,7 @@ use allocate_disk_receive_buffer and release_disk_receive_buffer../incl
// }
// no complete sync
- | ||
relevance 0 | ../src/bt_peer_connection.cpp:1754 | don't trust this blindly |
don't trust this blindly../src/bt_peer_connection.cpp:1754
- int last_seen_complete = boost::uint8_t(root.dict_find_int_value("complete_ago", -1));
- if (last_seen_complete >= 0) set_last_seen_complete(last_seen_complete);
-
- std::string client_info = root.dict_find_string_value("v");
- if (!client_info.empty()) m_client_version = client_info;
-
- int reqq = int(root.dict_find_int_value("reqq"));
- if (reqq > 0) m_max_out_request_queue = reqq;
-
- if (root.dict_find_int_value("upload_only", 0))
- set_upload_only(true);
-
- if (m_ses.m_settings.support_share_mode
- && root.dict_find_int_value("share_mode", 0))
- set_share_mode(true);
-
- std::string myip = root.dict_find_string_value("yourip");
- if (!myip.empty())
- {
- if (myip.size() == address_v4::bytes_type().size())
- {
- address_v4::bytes_type bytes;
- std::copy(myip.begin(), myip.end(), bytes.begin());
- m_ses.set_external_address(address_v4(bytes)
- , aux::session_impl::source_peer, remote().address());
- }
-#if TORRENT_USE_IPV6
- else if (myip.size() == address_v6::bytes_type().size())
- {
- address_v6::bytes_type bytes;
- std::copy(myip.begin(), myip.end(), bytes.begin());
- address_v6 ipv6_address(bytes);
- if (ipv6_address.is_v4_mapped())
- m_ses.set_external_address(ipv6_address.to_v4()
- , aux::session_impl::source_peer, remote().address());
- else
- m_ses.set_external_address(ipv6_address
- , aux::session_impl::source_peer, remote().address());
- }
-#endif
- }
-
- // if we're finished and this peer is uploading only
- // disconnect it
- if (t->is_finished() && upload_only()
- && t->settings().close_redundant_connections
- && !t->share_mode())
- disconnect(errors::upload_upload_connection);
- }
-
- | ||
relevance 0 | ../src/bt_peer_connection.cpp:2075 | if we're finished, send upload_only message |
if we're finished, send upload_only message../src/bt_peer_connection.cpp:2075 if (msg[5 + k / 8] & (0x80 >> (k % 8))) bitfield_string[k] = '1';
+ | ||
relevance 0 | ../src/bt_peer_connection.cpp:2074 | if we're finished, send upload_only message |
if we're finished, send upload_only message../src/bt_peer_connection.cpp:2074 if (msg[5 + k / 8] & (0x80 >> (k % 8))) bitfield_string[k] = '1';
else bitfield_string[k] = '0';
}
peer_log("==> BITFIELD [ %s ]", bitfield_string.c_str());
@@ -1745,8 +1245,8 @@ use allocate_disk_receive_buffer and release_disk_receive_buffer../incl
std::back_insert_iterator<std::string> out(remote_address);
detail::write_address(remote().address(), out);
handshake["yourip"] = remote_address;
- | ||
relevance 0 | ../src/bt_peer_connection.cpp:3317 | move the erasing into the loop above remove all payload ranges that has been sent |
move the erasing into the loop above
-remove all payload ranges that has been sent../src/bt_peer_connection.cpp:3317 for (std::vector<range>::iterator i = m_payloads.begin();
+ | ||
relevance 0 | ../src/bt_peer_connection.cpp:3316 | move the erasing into the loop above remove all payload ranges that has been sent |
move the erasing into the loop above
+remove all payload ranges that has been sent../src/bt_peer_connection.cpp:3316 for (std::vector<range>::iterator i = m_payloads.begin();
i != m_payloads.end(); ++i)
{
i->start -= bytes_transferred;
@@ -1797,7 +1297,7 @@ remove all payload ranges that has been sent../src/bt_peer_connection.c
TORRENT_ASSERT(m_sent_handshake);
}
- | ||
relevance 0 | ../src/file.cpp:1327 | is there any way to pre-fetch data from a file on windows? |
is there any way to pre-fetch data from a file on windows?../src/file.cpp:1327
+ | ||
relevance 0 | ../src/file.cpp:1327 | is there any way to pre-fetch data from a file on windows? |
is there any way to pre-fetch data from a file on windows?../src/file.cpp:1327
void file::init_file()
{
if (m_page_size != 0) return;
@@ -1848,7 +1348,7 @@ remove all payload ranges that has been sent../src/bt_peer_connection.c
#ifdef TORRENT_DEBUG
if (m_open_mode & no_buffer)
{
- | ||
relevance 0 | ../src/http_tracker_connection.cpp:99 | support authentication (i.e. user name and password) in the URL |
support authentication (i.e. user name and password) in the URL../src/http_tracker_connection.cpp:99 , aux::session_impl const& ses
+ | ||
relevance 0 | ../src/http_tracker_connection.cpp:99 | support authentication (i.e. user name and password) in the URL |
support authentication (i.e. user name and password) in the URL../src/http_tracker_connection.cpp:99 , aux::session_impl const& ses
, proxy_settings const& ps
, std::string const& auth
#if TORRENT_USE_I2P
@@ -1899,7 +1399,7 @@ remove all payload ranges that has been sent../src/bt_peer_connection.c
size_t arguments_start = url.find('?');
if (arguments_start != std::string::npos)
url += "&";
- | ||
relevance 0 | ../src/i2p_stream.cpp:181 | move this to proxy_base and use it in all proxies |
move this to proxy_base and use it in all proxies../src/i2p_stream.cpp:181 {
+ | ||
relevance 0 | ../src/i2p_stream.cpp:181 | move this to proxy_base and use it in all proxies |
move this to proxy_base and use it in all proxies../src/i2p_stream.cpp:181 {
m_state = sam_idle;
std::string name = m_sam_socket->name_lookup();
@@ -1950,7 +1450,7 @@ remove all payload ranges that has been sent../src/bt_peer_connection.c
void i2p_stream::connected(error_code const& e, boost::shared_ptr<handler_type> h)
{
#if defined TORRENT_ASIO_DEBUGGING
- | ||
relevance 0 | ../src/packet_buffer.cpp:176 | use compare_less_wrap for this comparison as well |
use compare_less_wrap for this comparison as well../src/packet_buffer.cpp:176 while (new_size < size)
+ | ||
relevance 0 | ../src/packet_buffer.cpp:176 | use compare_less_wrap for this comparison as well |
use compare_less_wrap for this comparison as well../src/packet_buffer.cpp:176 while (new_size < size)
new_size <<= 1;
void** new_storage = (void**)malloc(sizeof(void*) * new_size);
@@ -2001,7 +1501,7 @@ remove all payload ranges that has been sent../src/bt_peer_connection.c
if (m_storage[m_last & mask]) break;
++m_last;
m_last &= 0xffff;
- | ||
relevance 0 | ../src/peer_connection.cpp:2731 | this might need something more so that once we have the metadata we can construct a full bitfield |
this might need something more
+ | ||
relevance 0 | ../src/peer_connection.cpp:2731 | this might need something more so that once we have the metadata we can construct a full bitfield |
this might need something more
so that once we have the metadata
we can construct a full bitfield../src/peer_connection.cpp:2731
#ifdef TORRENT_VERBOSE_LOGGING
@@ -2054,7 +1554,7 @@ we can construct a full bitfield../src/peer_connection.cpp:2731 | ||
relevance 0 | ../src/peer_connection.cpp:2862 | sort the allowed fast set in priority order |
sort the allowed fast set in priority order../src/peer_connection.cpp:2862 // this piece index later
+ | ||
relevance 0 | ../src/peer_connection.cpp:2862 | sort the allowed fast set in priority order |
sort the allowed fast set in priority order../src/peer_connection.cpp:2862 // this piece index later
m_allowed_fast.push_back(index);
// if the peer has the piece and we want
@@ -2105,59 +1605,8 @@ we can construct a full bitfield../src/peer_connection.cpp:2731 | ||
relevance 0 | ../src/peer_connection.cpp:3986 | we should probably just send a HAVE_ALL here |
we should probably just send a HAVE_ALL here../src/peer_connection.cpp:3986 std::fill(m_recv_buffer.begin() + m_recv_pos, m_recv_buffer.end(), 0);
-#endif
-
- m_packet_size = packet_size;
- }
-
- void peer_connection::superseed_piece(int replace_piece, int new_piece)
- {
- if (new_piece == -1)
- {
- if (m_superseed_piece[0] == -1) return;
- m_superseed_piece[0] = -1;
- m_superseed_piece[1] = -1;
-
-#ifdef TORRENT_VERBOSE_LOGGING
- peer_log("*** ending super seed mode");
-#endif
- boost::shared_ptr<torrent> t = m_torrent.lock();
- assert(t);
-
- for (int i = 0; i < int(m_have_piece.size()); ++i)
- {
- if (m_have_piece[i] || !t->have_piece(i)) continue;
-#ifdef TORRENT_VERBOSE_LOGGING
- peer_log("==> HAVE [ piece: %d] (ending super seed)", i);
-#endif
- write_have(i);
- }
-
- return;
- }
-
- assert(!has_piece(new_piece));
-
-#ifdef TORRENT_VERBOSE_LOGGING
- peer_log("==> HAVE [ piece: %d ] (super seed)", new_piece);
-#endif
- write_have(new_piece);
-
- if (replace_piece >= 0)
- {
- // move the piece we're replacing to the tail
- if (m_superseed_piece[0] == replace_piece)
- std::swap(m_superseed_piece[0], m_superseed_piece[1]);
- }
-
- m_superseed_piece[1] = m_superseed_piece[0];
- m_superseed_piece[0] = new_piece;
- }
-
- void peer_connection::update_desired_queue_size()
- | ||
relevance 0 | ../src/peer_connection.cpp:4576 | peers should really be corked/uncorked outside of all completed disk operations |
peers should really be corked/uncorked outside of
-all completed disk operations../src/peer_connection.cpp:4576 // this means we're in seed mode and we haven't yet
+ | ||
relevance 0 | ../src/peer_connection.cpp:4575 | peers should really be corked/uncorked outside of all completed disk operations |
peers should really be corked/uncorked outside of
+all completed disk operations../src/peer_connection.cpp:4575 // this means we're in seed mode and we haven't yet
// verified this piece (r.piece)
t->filesystem().async_read_and_hash(r, boost::bind(&peer_connection::on_disk_read_complete
, self(), _1, _2, r), cache.second);
@@ -2208,7 +1657,7 @@ all completed disk operations../src/peer_connection.cpp:4576 | ||
relevance 0 | ../src/policy.cpp:857 | only allow _one_ connection to use this override at a time |
only allow _one_ connection to use this
+ | ||
relevance 0 | ../src/policy.cpp:857 | only allow _one_ connection to use this override at a time |
only allow _one_ connection to use this
override at a time../src/policy.cpp:857 " external: " << external.external_address(m_peers[candidate]->address()) <<
" t: " << (session_time - m_peers[candidate]->last_connected) <<
" ]\n";
@@ -2260,7 +1709,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/policy.cpp:1897 | how do we deal with our external address changing? Pass in a force-update maybe? and keep a version number in policy |
|
how do we deal with our external address changing? Pass in a force-update maybe? and keep a version number in policy../src/policy.cpp:1897#endif
+ | ||
relevance 0 | ../src/policy.cpp:1897 | how do we deal with our external address changing? Pass in a force-update maybe? and keep a version number in policy |
how do we deal with our external address changing? Pass in a force-update maybe? and keep a version number in policy../src/policy.cpp:1897#endif
, on_parole(false)
, banned(false)
#ifndef TORRENT_DISABLE_DHT
@@ -2311,7 +1760,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:1913 | recalculate all connect candidates for all torrents |
|
recalculate all connect candidates for all torrents../src/session_impl.cpp:1913 m_upload_rate.close();
+ | ||
relevance 0 | ../src/session_impl.cpp:1938 | recalculate all connect candidates for all torrents |
recalculate all connect candidates for all torrents../src/session_impl.cpp:1938 m_upload_rate.close();
// #error closing the udp socket here means that
// the uTP connections cannot be closed gracefully
@@ -2359,10 +1808,10 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:3293 | have a separate list for these connections, instead of having to loop through all of them |
|
have a separate list for these connections, instead of having to loop through all of them../src/session_impl.cpp:3293 // --------------------------------------------------------------
+ | ||
relevance 0 | ../src/session_impl.cpp:3362 | have a separate list for these connections, instead of having to loop through all of them |
have a separate list for these connections, instead of having to loop through all of them../src/session_impl.cpp:3362 // --------------------------------------------------------------
if (!m_paused) m_auto_manage_time_scaler--;
if (m_auto_manage_time_scaler < 0)
{
@@ -2413,7 +1862,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:4353 | allow extensions to sort torrents for queuing |
|
allow extensions to sort torrents for queuing../src/session_impl.cpp:4353 else if (!t->is_paused())
+ | ||
relevance 0 | ../src/session_impl.cpp:4435 | allow extensions to sort torrents for queuing |
allow extensions to sort torrents for queuing../src/session_impl.cpp:4435 else if (!t->is_paused())
{
TORRENT_ASSERT(t->m_resume_data_loaded || !t->valid_metadata());
--hard_limit;
@@ -2464,9 +1913,9 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:4509 | use a lower limit than m_settings.connections_limit to allocate the to 10% or so of connection slots for incoming connections |
|
use a lower limit than m_settings.connections_limit
+ | ||
relevance 0 | ../src/session_impl.cpp:4591 | use a lower limit than m_settings.connections_limit to allocate the to 10% or so of connection slots for incoming connections |
use a lower limit than m_settings.connections_limit
to allocate the to 10% or so of connection slots for incoming
-connections../src/session_impl.cpp:4509 {
+connections../src/session_impl.cpp:4591 {
if (m_boost_connections > max_connections)
{
m_boost_connections -= max_connections;
@@ -2517,7 +1966,7 @@ connections../src/session_impl.cpp:4509relevance 0 | ../src/session_impl.cpp:4543 | make this bias configurable |
|
make this bias configurable../src/session_impl.cpp:4543 | ||
relevance 0 | ../src/session_impl.cpp:4544 | also take average_peers into account, to create a bias for downloading torrents with < average peers |
also take average_peers into account, to create a bias for downloading torrents with < average peers../src/session_impl.cpp:4544 average_peers = num_downloads_peers / num_downloads;
+ | ||
relevance 0 | ../src/session_impl.cpp:4625 | make this bias configurable |
make this bias configurable../src/session_impl.cpp:4625 | ||
relevance 0 | ../src/session_impl.cpp:4626 | also take average_peers into account, to create a bias for downloading torrents with < average peers |
also take average_peers into account, to create a bias for downloading torrents with < average peers../src/session_impl.cpp:4626 average_peers = num_downloads_peers / num_downloads;
if (m_next_connect_torrent == m_torrents.end())
m_next_connect_torrent = m_torrents.begin();
@@ -2568,7 +2017,7 @@ connections../src/session_impl.cpp:4509relevance 0 | ../src/session_impl.cpp:4688 | make configurable |
|
make configurable../src/session_impl.cpp:4688
+ | ||
relevance 0 | ../src/session_impl.cpp:4770 | make configurable |
make configurable../src/session_impl.cpp:4770
#ifdef TORRENT_DEBUG
for (std::vector<peer_connection*>::const_iterator i = peers.begin()
, end(peers.end()), prev(peers.end()); i != end; ++i)
@@ -2601,7 +2050,7 @@ connections../src/session_impl.cpp:4509relevance 0 | ../src/session_impl.cpp:4702 | make configurable |
|
make configurable../src/session_impl.cpp:4702 >= (*i)->uploaded_in_last_round() * 1000
+ | ||
relevance 0 | ../src/session_impl.cpp:4784 | make configurable |
make configurable../src/session_impl.cpp:4784 >= (*i)->uploaded_in_last_round() * 1000
* (1 + t2->priority()) / total_milliseconds(unchoke_interval));
}
prev = i;
@@ -2652,7 +2101,7 @@ connections../src/session_impl.cpp:4509 | ||
relevance 0 | ../src/storage.cpp:324 | if the read fails, set error and exit immediately |
if the read fails, set error and exit immediately../src/storage.cpp:324 if (m_storage->disk_pool()) block_size = m_storage->disk_pool()->block_size();
+ | ||
relevance 0 | ../src/storage.cpp:324 | if the read fails, set error and exit immediately |
if the read fails, set error and exit immediately../src/storage.cpp:324 if (m_storage->disk_pool()) block_size = m_storage->disk_pool()->block_size();
int size = slot_size;
int num_blocks = (size + block_size - 1) / block_size;
@@ -2703,7 +2152,7 @@ connections../src/session_impl.cpp:4509relevance 0 | ../src/storage.cpp:358 | if the read fails, set error and exit immediately |
|
if the read fails, set error and exit immediately../src/storage.cpp:358 {
+ | ||
relevance 0 | ../src/storage.cpp:358 | if the read fails, set error and exit immediately |
if the read fails, set error and exit immediately../src/storage.cpp:358 {
ph.h.update((char const*)bufs[i].iov_base, bufs[i].iov_len);
small_piece_size -= bufs[i].iov_len;
}
@@ -2754,7 +2203,7 @@ connections../src/session_impl.cpp:4509relevance 0 | ../src/storage.cpp:629 | make this more generic to not just work if files have been renamed, but also if they have been merged into a single file for instance maybe use the same format as .torrent files and reuse some code from torrent_info |
|
make this more generic to not just work if files have been
+ | ||
relevance 0 | ../src/storage.cpp:629 | make this more generic to not just work if files have been renamed, but also if they have been merged into a single file for instance maybe use the same format as .torrent files and reuse some code from torrent_info |
make this more generic to not just work if files have been
renamed, but also if they have been merged into a single file for instance
maybe use the same format as .torrent files and reuse some code from torrent_info../src/storage.cpp:629 for (;;)
{
@@ -2807,7 +2256,7 @@ maybe use the same format as .torrent files and reuse some code from torrent_inf
for (int i = 0; i < file_sizes_ent->list_size(); ++i)
{
- | ||
relevance 0 | ../src/storage.cpp:1238 | what if file_base is used to merge several virtual files into a single physical file? We should probably disable this if file_base is used. This is not a widely used feature though |
what if file_base is used to merge several virtual files
+ | ||
relevance 0 | ../src/storage.cpp:1238 | what if file_base is used to merge several virtual files into a single physical file? We should probably disable this if file_base is used. This is not a widely used feature though |
what if file_base is used to merge several virtual files
into a single physical file? We should probably disable this
if file_base is used. This is not a widely used feature though../src/storage.cpp:1238 int bytes_transferred = 0;
// if the file is opened in no_buffer mode, and the
@@ -2860,12 +2309,12 @@ if file_base is used. This is not a widely used feature though../src/st
// makes unaligned requests (and the disk cache is disabled or fully utilized
// for write cache).
- | ||
relevance 0 | ../src/torrent.cpp:1370 | is verify_peer_cert called once per certificate in the chain, and this function just tells us which depth we're at right now? If so, the comment makes sense. any certificate that isn't the leaf (i.e. the one presented by the peer) should be accepted automatically, given preverified is true. The leaf certificate need to be verified to make sure its DN matches the info-hash |
is verify_peer_cert called once per certificate in the chain, and
+ | ||
relevance 0 | ../src/torrent.cpp:1362 | is verify_peer_cert called once per certificate in the chain, and this function just tells us which depth we're at right now? If so, the comment makes sense. any certificate that isn't the leaf (i.e. the one presented by the peer) should be accepted automatically, given preverified is true. The leaf certificate need to be verified to make sure its DN matches the info-hash |
is verify_peer_cert called once per certificate in the chain, and
this function just tells us which depth we're at right now? If so, the comment
makes sense.
any certificate that isn't the leaf (i.e. the one presented by the peer)
should be accepted automatically, given preverified is true. The leaf certificate
-need to be verified to make sure its DN matches the info-hash../src/torrent.cpp:1370 if (pp) p->add_extension(pp);
+need to be verified to make sure its DN matches the info-hash../src/torrent.cpp:1362 if (pp) p->add_extension(pp);
}
// if files are checked for this torrent, call the extension
@@ -2916,12 +2365,12 @@ need to be verified to make sure its DN matches the info-hash../src/tor
{
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
match = true;
- | ||
relevance 0 | ../src/torrent.cpp:5155 | make this more generic to not just work if files have been renamed, but also if they have been merged into a single file for instance maybe use the same format as .torrent files and reuse some code from torrent_info The mapped_files needs to be read both in the network thread and in the disk thread, since they both have their own mapped files structures which are kept in sync |
make this more generic to not just work if files have been
+ | ||
relevance 0 | ../src/torrent.cpp:5167 | make this more generic to not just work if files have been renamed, but also if they have been merged into a single file for instance maybe use the same format as .torrent files and reuse some code from torrent_info The mapped_files needs to be read both in the network thread and in the disk thread, since they both have their own mapped files structures which are kept in sync |
make this more generic to not just work if files have been
renamed, but also if they have been merged into a single file for instance
maybe use the same format as .torrent files and reuse some code from torrent_info
The mapped_files needs to be read both in the network thread
and in the disk thread, since they both have their own mapped files structures
-which are kept in sync../src/torrent.cpp:5155 if (m_seed_mode) m_verified.resize(m_torrent_file->num_pieces(), false);
+which are kept in sync../src/torrent.cpp:5167 if (m_seed_mode) m_verified.resize(m_torrent_file->num_pieces(), false);
super_seeding(rd.dict_find_int_value("super_seeding", 0));
m_last_scrape = rd.dict_find_int_value("last_scrape", 0);
@@ -2972,12 +2421,12 @@ which are kept in sync../src/torrent.cpp:5155relevance 0 | ../src/torrent.cpp:5291 | if this is a merkle torrent and we can't restore the tree, we need to wipe all the bits in the have array, but not necessarily we might want to do a full check to see if we have all the pieces. This is low priority since almost no one uses merkle torrents |
|
if this is a merkle torrent and we can't
+ | ||
relevance 0 | ../src/torrent.cpp:5303 | if this is a merkle torrent and we can't restore the tree, we need to wipe all the bits in the have array, but not necessarily we might want to do a full check to see if we have all the pieces. This is low priority since almost no one uses merkle torrents |
if this is a merkle torrent and we can't
restore the tree, we need to wipe all the
bits in the have array, but not necessarily
we might want to do a full check to see if we have
all the pieces. This is low priority since almost
-no one uses merkle torrents../src/torrent.cpp:5291 add_web_seed(url, web_seed_entry::http_seed);
+no one uses merkle torrents../src/torrent.cpp:5303 add_web_seed(url, web_seed_entry::http_seed);
}
}
@@ -3028,9 +2477,9 @@ no one uses merkle torrents../src/torrent.cpp:5291 | ||
relevance 0 | ../src/torrent.cpp:5479 | make this more generic to not just work if files have been renamed, but also if they have been merged into a single file for instance. using file_base |
make this more generic to not just work if files have been
+ | ||
relevance 0 | ../src/torrent.cpp:5491 | make this more generic to not just work if files have been renamed, but also if they have been merged into a single file for instance. using file_base |
make this more generic to not just work if files have been
renamed, but also if they have been merged into a single file for instance.
-using file_base../src/torrent.cpp:5479 entry::string_type& pieces = ret["pieces"].string();
+using file_base../src/torrent.cpp:5491 entry::string_type& pieces = ret["pieces"].string();
pieces.resize(m_torrent_file->num_pieces());
if (is_seed())
{
@@ -3081,10 +2530,10 @@ using file_base../src/torrent.cpp:5479relevance 0 | ../src/torrent.cpp:8000 | go through the pieces we have and count the total number of downloaders we have. Only count peers that are interested in us since some peers might not send have messages for pieces we have it num_interested == 0, we need to pick a new piece |
|
go through the pieces we have and count the total number
+ | ||
relevance 0 | ../src/torrent.cpp:8021 | go through the pieces we have and count the total number of downloaders we have. Only count peers that are interested in us since some peers might not send have messages for pieces we have it num_interested == 0, we need to pick a new piece |
go through the pieces we have and count the total number
of downloaders we have. Only count peers that are interested in us
since some peers might not send have messages for pieces we have
-it num_interested == 0, we need to pick a new piece../src/torrent.cpp:8000 }
+it num_interested == 0, we need to pick a new piece../src/torrent.cpp:8021 }
rarest_pieces.clear();
rarest_rarity = pp.peer_count;
@@ -3135,7 +2584,7 @@ it num_interested == 0, we need to pick a new piece../src/torrent.cpp:8
{
m_picker->get_availability(avail_vec);
}
- | ||
relevance 0 | ../src/udp_tracker_connection.cpp:552 | it would be more efficient to not use a string here. however, the problem is that some trackers will respond with actual strings. For example i2p trackers |
it would be more efficient to not use a string here.
+ | ||
relevance 0 | ../src/udp_tracker_connection.cpp:552 | it would be more efficient to not use a string here. however, the problem is that some trackers will respond with actual strings. For example i2p trackers |
it would be more efficient to not use a string here.
however, the problem is that some trackers will respond
with actual strings. For example i2p trackers../src/udp_tracker_connection.cpp:552 }
@@ -3188,7 +2637,110 @@ with actual strings. For example i2p trackers../src/udp_tracker_connect
{
restart_read_timeout();
int action = detail::read_int32(buf);
- | ||
relevance 0 | ../include/libtorrent/config.hpp:305 | Make this count Unicode characters instead of bytes on windows |
Make this count Unicode characters instead of bytes on windows../include/libtorrent/config.hpp:305
+ | ||
relevance 0 | ../src/utp_stream.cpp:1573 | this loop may not be very efficient |
this loop may not be very efficient../src/utp_stream.cpp:1573 TORRENT_ASSERT(p->header_size >= sizeof(utp_header) + sack_size + 2);
+ memmove(ptr, ptr + sack_size + 2, p->size - p->header_size);
+ p->header_size -= sack_size + 2;
+ p->size -= sack_size + 2;
+}
+
+// sends a packet, pulls data from the write buffer (if there's any)
+// if ack is true, we need to send a packet regardless of if there's
+// any data. Returns true if we could send more data (i.e. call
+// send_pkt() again)
+bool utp_socket_impl::send_pkt(int flags)
+{
+ INVARIANT_CHECK;
+
+ bool force = (flags & pkt_ack) || (flags & pkt_fin);
+
+// TORRENT_ASSERT(m_state != UTP_STATE_FIN_SENT || (flags & pkt_ack));
+
+ // first see if we need to resend any packets
+
+ for (int i = (m_acked_seq_nr + 1) & ACK_MASK; i != m_seq_nr; i = (i + 1) & ACK_MASK)
+ {
+ packet* p = (packet*)m_outbuf.at(i);
+ if (!p) continue;
+ if (!p->need_resend) continue;
+ if (!resend_packet(p))
+ {
+ // we couldn't resend the packet. It probably doesn't
+ // fit in our cwnd. If force is set, we need to continue
+ // to send our packet anyway, if we don't have force set,
+ // we might as well return
+ if (!force) return false;
+ // resend_packet might have failed
+ if (m_state == UTP_STATE_ERROR_WAIT || m_state == UTP_STATE_DELETE) return false;
+ break;
+ }
+
+ // don't fast-resend this packet
+ if (m_fast_resend_seq_nr == i)
+ m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) & ACK_MASK;
+ }
+
+ int sack = 0;
+ if (m_inbuf.size())
+ {
+ // the SACK bitfield should ideally fit all
+ // the pieces we have successfully received
+ sack = (m_inbuf.span() + 7) / 8;
+ if (sack > 32) sack = 32;
+ }
+
+ | ||
relevance 0 | ../src/kademlia/routing_table.cpp:265 | instad of refreshing a bucket by using find_nodes, ping each node periodically |
instad of refreshing a bucket by using find_nodes,
+ping each node periodically../src/kademlia/routing_table.cpp:265 os << "]\n";
+ }
+}
+
+#endif
+
+void routing_table::touch_bucket(node_id const& target)
+{
+ table_t::iterator i = find_bucket(target);
+ i->last_active = time_now();
+}
+
+// returns true if lhs is in more need of a refresh than rhs
+bool compare_bucket_refresh(routing_table_node const& lhs, routing_table_node const& rhs)
+{
+ // add the number of nodes to prioritize buckets with few nodes in them
+ return lhs.last_active + seconds(lhs.live_nodes.size() * 5)
+ < rhs.last_active + seconds(rhs.live_nodes.size() * 5);
+}
+
+bool routing_table::need_refresh(node_id& target) const
+ {
+ ptime now = time_now();
+
+ // refresh our own bucket once every 15 minutes
+ if (now - m_last_self_refresh > minutes(15))
+ {
+ m_last_self_refresh = now;
+ target = m_id;
+#ifdef TORRENT_DHT_VERBOSE_LOGGING
+ TORRENT_LOG(table) << "need_refresh [ bucket: self target: " << target << " ]";
+#endif
+ return true;
+ }
+
+ if (m_buckets.empty()) return false;
+
+ table_t::const_iterator i = std::min_element(m_buckets.begin(), m_buckets.end()
+ , &compare_bucket_refresh);
+
+ if (now - i->last_active < minutes(15)) return false;
+ if (now - m_last_refresh < seconds(45)) return false;
+
+ // generate a random node_id within the given bucket
+ target = generate_random_id();
+ int num_bits = std::distance(m_buckets.begin(), i) + 1;
+ node_id mask(0);
+ for (int i = 0; i < num_bits; ++i) mask[i/8] |= 0x80 >> (i&7);
+
+ // target = (target & ~mask) | (root & mask)
+ node_id root = m_id;
+ | ||
relevance 0 | ../include/libtorrent/config.hpp:305 | Make this count Unicode characters instead of bytes on windows |
Make this count Unicode characters instead of bytes on windows../include/libtorrent/config.hpp:305
// ==== eCS(OS/2) ===
#elif defined __OS2__
#define TORRENT_OS2
@@ -3239,9 +2791,9 @@ with actual strings. For example i2p trackers../src/udp_tracker_connect
#include <stdarg.h>
// internal
- | ||
relevance 0 | ../include/libtorrent/proxy_base.hpp:152 | it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec); |
it would be nice to remember the bind port and bind once we know where the proxy is
-m_sock.bind(endpoint, ec);../include/libtorrent/proxy_base.hpp:152 {
- return m_sock.set_option(opt, ec);
+ | ||
relevance 0 | ../include/libtorrent/proxy_base.hpp:166 | it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec); |
it would be nice to remember the bind port and bind once we know where the proxy is
+m_sock.bind(endpoint, ec);../include/libtorrent/proxy_base.hpp:166 {
+ return m_sock.get_option(opt, ec);
}
#ifndef BOOST_NO_EXCEPTIONS
@@ -3291,7 +2843,7 @@ m_sock.bind(endpoint, ec);../include/libtorrent/proxy_base.hpp:152
m_sock.close(ec);
m_resolver.cancel();
}
- | ||
relevance 0 | ../include/libtorrent/torrent_info.hpp:122 | include the number of peers received from this tracker, at last announce |
include the number of peers received from this tracker, at last announce../include/libtorrent/torrent_info.hpp:122
+ | ||
relevance 0 | ../include/libtorrent/torrent_info.hpp:123 | include the number of peers received from this tracker, at last announce |
include the number of peers received from this tracker, at last announce../include/libtorrent/torrent_info.hpp:123
// if this tracker failed the last time it was contacted
// this error code specifies what error occurred
error_code last_error;
@@ -3342,4 +2894,55 @@ m_sock.bind(endpoint, ec);../include/libtorrent/proxy_base.hpp:152
// flags for the source bitmask, each indicating where
// we heard about this tracker
enum tracker_source
+ | ||
relevance 0 | ../include/libtorrent/upnp.hpp:121 | support using the windows API for UPnP operations as well |
support using the windows API for UPnP operations as well../include/libtorrent/upnp.hpp:121 {
+ virtual const char* name() const;
+ virtual std::string message(int ev) const;
+ virtual boost::system::error_condition default_error_condition(int ev) const
+ { return boost::system::error_condition(ev, *this); }
+ };
+
+ extern TORRENT_EXPORT upnp_error_category upnp_category;
+#endif
+
+// int: port-mapping index
+// address: external address as queried from router
+// int: external port
+// std::string: error message
+// an empty string as error means success
+// a port-mapping index of -1 means it's
+// an informational log message
+typedef boost::function<void(int, address, int, error_code const&)> portmap_callback_t;
+typedef boost::function<void(char const*)> log_callback_t;
+
+class TORRENT_EXTRA_EXPORT upnp : public intrusive_ptr_base<upnp>
+ {
+public:
+ upnp(io_service& ios, connection_queue& cc
+ , address const& listen_interface, std::string const& user_agent
+ , portmap_callback_t const& cb, log_callback_t const& lcb
+ , bool ignore_nonrouters, void* state = 0);
+ ~upnp();
+
+ void* drain_state();
+
+ enum protocol_type { none = 0, udp = 1, tcp = 2 };
+
+ // Attempts to add a port mapping for the specified protocol. Valid protocols are
+ // ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and
+ // ``natpmp::udp`` for the NAT-PMP class.
+ //
+ // ``external_port`` is the port on the external address that will be mapped. This
+ // is a hint, you are not guaranteed that this port will be available, and it may
+ // end up being something else. In the portmap_alert_ notification, the actual
+ // external port is reported.
+ //
+ // ``local_port`` is the port in the local machine that the mapping should forward
+ // to.
+ //
+ // The return value is an index that identifies this port mapping. This is used
+ // to refer to mappings that fails or succeeds in the portmap_error_alert_ and
+ // portmap_alert_ respectively. If The mapping fails immediately, the return value
+ // is -1, which means failure. There will not be any error alert notification for
+ // mappings that fail with a -1 return value.
+ int add_mapping(protocol_type p, int external_port, int local_port);
| ||