relevance 3 | ../src/torrent.cpp:5801 | support SSL over uTP |
support SSL over uTP../src/torrent.cpp:5801 // we'll instantiate a TCP connection
+ utp_socket_manager* sm = 0;
+
+ if (m_ses.m_settings.enable_outgoing_utp
+ && (!m_ses.m_settings.enable_outgoing_tcp
+ || peerinfo->supports_utp
+ || peerinfo->confirmed_supports_utp))
+ sm = &m_ses.m_utp_socket_manager;
+
+ // don't make a TCP connection if it's disabled
+ if (sm == 0 && !m_ses.m_settings.enable_outgoing_tcp) return false;
+
+ void* userdata = 0;
+#ifdef TORRENT_USE_OPENSSL
+ if (is_ssl_torrent() && m_ses.settings().ssl_listen != 0)
+ {
+ userdata = m_ssl_ctx.get();
+ // SSL handshakes are slow
+ timeout_extend = 10;
+
+ sm = 0;
+ }
+#endif
+
+ bool ret = instantiate_connection(m_ses.m_io_service, m_ses.proxy(), *s, userdata, sm, true);
+ (void)ret;
+ TORRENT_ASSERT(ret);
+
+#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;
}
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
m_connections.insert(p);
@@ -76,358 +127,7 @@
return m_connections.size() < m_max_connections
&& !is_paused()
&& ((m_state != torrent_status::checking_files
- | ||
relevance 3 | ../include/libtorrent/natpmp.hpp:56 | should this really be a public symbol? also, make this a shared_ptr instead |
should this really be a public symbol?
-also, 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 TORRENT_EXPORT 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 3 | ../include/libtorrent/peer_id.hpp:61 | rename this to sha1_hash |
rename this to sha1_hash../include/libtorrent/peer_id.hpp:61#include "libtorrent/config.hpp"
-#include "libtorrent/assert.hpp"
-
-#if TORRENT_USE_IOSTREAM
-#include "libtorrent/escape_string.hpp" // to_hex, from_hex
-#include <iostream>
-#include <iomanip>
-#endif
-
-#ifdef max
-#undef max
-#endif
-
-#ifdef min
-#undef min
-#endif
-
-namespace libtorrent
-{
-
- class TORRENT_EXPORT big_number
- {
- // the number of bytes of the number
- enum { number_size = 20 };
- public:
- enum { size = number_size };
-
- big_number() { clear(); }
-
- static big_number max()
- {
- big_number ret;
- memset(ret.m_number, 0xff, size);
- return ret;
- }
-
- static big_number min()
- {
- big_number ret;
- memset(ret.m_number, 0, size);
- return ret;
- }
-
- explicit big_number(char const* s)
- {
- if (s == 0) clear();
- else std::memcpy(m_number, s, size);
- }
-
- explicit big_number(std::string const& s)
- {
- | ||
relevance 3 | ../include/libtorrent/session.hpp:101 | make this an implementation detail |
make this an implementation detail../include/libtorrent/session.hpp:101 class port_filter;
- class connection_queue;
- class natpmp;
- class upnp;
- class alert;
-
- TORRENT_EXPORT session_settings min_memory_usage();
- TORRENT_EXPORT session_settings high_performance_seed();
-
-#ifndef TORRENT_CFG
-#error TORRENT_CFG is not defined!
-#endif
-
- void TORRENT_EXPORT TORRENT_CFG();
-
- namespace aux
- {
- // workaround for microsofts
- // hardware exceptions that makes
- // it hard to debug stuff
-#ifdef _MSC_VER
- struct TORRENT_EXPORT eh_initializer
- {
- eh_initializer();
- static void straight_to_debugger(unsigned int, _EXCEPTION_POINTERS*)
- { throw; }
- };
-#else
- struct eh_initializer {};
-#endif
- struct session_impl;
- }
-
- class TORRENT_EXPORT session_proxy
- {
- friend class session;
- public:
- session_proxy() {}
- private:
- session_proxy(boost::shared_ptr<aux::session_impl> impl)
- : m_impl(impl) {}
- boost::shared_ptr<aux::session_impl> m_impl;
- };
-
-#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
-#define TORRENT_LOGPATH_ARG_DEFAULT , std::string logpath = "."
-#else
-#define TORRENT_LOGPATH_ARG_DEFAULT
-#endif
-
- // Once it's created, the session object will spawn the main thread that will do all the work.
- | ||
relevance 3 | ../include/libtorrent/time.hpp:44 | do these two really need to be exposed to users? |
do these two really need to be exposed to users?../include/libtorrent/time.hpp:44CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef TORRENT_TIME_HPP_INCLUDED
-#define TORRENT_TIME_HPP_INCLUDED
-
-#include <boost/version.hpp>
-#include "libtorrent/config.hpp"
-#include "libtorrent/ptime.hpp"
-#include <boost/cstdint.hpp>
-#include <string>
-
-namespace libtorrent
-{
- TORRENT_EXPORT char const* time_now_string();
- TORRENT_EXPORT std::string log_time();
-
- TORRENT_EXPORT ptime time_now_hires();
- TORRENT_EXPORT ptime min_time();
- TORRENT_EXPORT ptime max_time();
-
-#if defined TORRENT_USE_BOOST_DATE_TIME
-
- TORRENT_EXPORT time_duration seconds(int s);
- TORRENT_EXPORT time_duration milliseconds(int s);
- TORRENT_EXPORT time_duration microsec(int s);
- TORRENT_EXPORT time_duration minutes(int s);
- TORRENT_EXPORT time_duration hours(int s);
-
- TORRENT_EXPORT int total_seconds(time_duration td);
- TORRENT_EXPORT int total_milliseconds(time_duration td);
- TORRENT_EXPORT boost::int64_t total_microseconds(time_duration td);
-
-#elif defined TORRENT_USE_QUERY_PERFORMANCE_TIMER
-
- namespace aux
- {
- | ||
relevance 3 | ../include/libtorrent/time.hpp:68 | move these to time.cpp |
move these to time.cpp../include/libtorrent/time.hpp:68 TORRENT_EXPORT ptime time_now_hires();
- TORRENT_EXPORT ptime min_time();
- TORRENT_EXPORT ptime max_time();
-
-#if defined TORRENT_USE_BOOST_DATE_TIME
-
- TORRENT_EXPORT time_duration seconds(int s);
- TORRENT_EXPORT time_duration milliseconds(int s);
- TORRENT_EXPORT time_duration microsec(int s);
- TORRENT_EXPORT time_duration minutes(int s);
- TORRENT_EXPORT time_duration hours(int s);
-
- TORRENT_EXPORT int total_seconds(time_duration td);
- TORRENT_EXPORT int total_milliseconds(time_duration td);
- TORRENT_EXPORT boost::int64_t total_microseconds(time_duration td);
-
-#elif defined TORRENT_USE_QUERY_PERFORMANCE_TIMER
-
- namespace aux
- {
- TORRENT_EXPORT boost::int64_t performance_counter_to_microseconds(boost::int64_t pc);
- TORRENT_EXPORT boost::int64_t microseconds_to_performance_counter(boost::int64_t ms);
- }
-
- inline int total_seconds(time_duration td)
- {
- return int(aux::performance_counter_to_microseconds(td.diff)
- / 1000000);
- }
- inline int total_milliseconds(time_duration td)
- {
- return int(aux::performance_counter_to_microseconds(td.diff)
- / 1000);
- }
- inline boost::int64_t total_microseconds(time_duration td)
- {
- return aux::performance_counter_to_microseconds(td.diff);
- }
-
- inline time_duration microsec(boost::int64_t s)
- {
- return time_duration(aux::microseconds_to_performance_counter(s));
- }
- inline time_duration milliseconds(boost::int64_t s)
- {
- return time_duration(aux::microseconds_to_performance_counter(
- s * 1000));
- }
- inline time_duration seconds(boost::int64_t s)
- {
- return time_duration(aux::microseconds_to_performance_counter(
- | ||
relevance 3 | ../include/libtorrent/torrent_info.hpp:238 | should this really be a public symbol? |
should this really be a public symbol?../include/libtorrent/torrent_info.hpp:238 // if the user wanted to remove this while
- // we were resolving it. In this case, we set
- // the removed flag to true, to make the resolver
- // callback remove it
- bool removed;
-
- tcp::endpoint endpoint;
-
- // this is the peer_info field used for the
- // connection, just to count hash failures
- // it's also used to hold the peer_connection
- // pointer, when the web seed is connected
- policy::peer peer_info;
- };
-
-#ifndef BOOST_NO_EXCEPTIONS
- // for backwards compatibility with 0.14
- typedef libtorrent_exception invalid_torrent_file;
-#endif
-
- int TORRENT_EXPORT load_file(std::string const& filename
- , std::vector<char>& v, error_code& ec, int limit = 8000000);
-
- class TORRENT_EXPORT torrent_info : public intrusive_ptr_base<torrent_info>
- {
- public:
-
-#ifdef TORRENT_DEBUG
- void check_invariant() const;
-#endif
-
-#ifndef BOOST_NO_EXCEPTIONS
- torrent_info(lazy_entry const& torrent_file, int flags = 0);
- torrent_info(char const* buffer, int size, int flags = 0);
- torrent_info(std::string const& filename, int flags = 0);
-#if TORRENT_USE_WSTRING
- torrent_info(std::wstring const& filename, int flags = 0);
-#endif // TORRENT_USE_WSTRING
-#endif
-
- torrent_info(torrent_info const& t, int flags = 0);
- torrent_info(sha1_hash const& info_hash, int flags = 0);
- torrent_info(lazy_entry const& torrent_file, error_code& ec, int flags = 0);
- torrent_info(char const* buffer, int size, error_code& ec, int flags = 0);
- torrent_info(std::string const& filename, error_code& ec, int flags = 0);
-#if TORRENT_USE_WSTRING
- torrent_info(std::wstring const& filename, error_code& ec, int flags = 0);
-#endif // TORRENT_USE_WSTRING
-
- ~torrent_info();
-
- | ||
relevance 3 | ../include/libtorrent/upnp.hpp:102 | should this really be a public symbol? also, make this a shared_ptr instead |
should this really be a public symbol?
-also, make this a shared_ptr instead../include/libtorrent/upnp.hpp:102 {
- 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_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 };
- 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 discover_device();
- void close();
-
- std::string router_model()
- {
- mutex::scoped_lock l(m_mutex);
- return m_model;
- }
-
-private:
-
- void discover_device_impl(mutex::scoped_lock& l);
- static address_v4 upnp_multicast_address;
- static udp::endpoint upnp_multicast_endpoint;
-
- | ||
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;
+ | ||
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
@@ -478,7 +178,7 @@ namespace libtorrent { namespace dht
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>
@@ -530,7 +230,7 @@ private:
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
+ | ||
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
@@ -582,7 +282,7 @@ in the torrent. That should be taken into account here.../src/piece_pic
// ignored as long as possible. All blocks found in downloading
// pieces are regarded as backup blocks
- | ||
relevance 2 | ../src/session_impl.cpp:5157 | 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:5157 }
+ | ||
relevance 2 | ../src/session_impl.cpp:5177 | 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:5177 }
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
else
@@ -633,7 +333,7 @@ in the torrent. That should be taken into account here.../src/piece_pic
torrent_ptr->start();
#ifndef TORRENT_DISABLE_EXTENSIONS
- | ||
relevance 2 | ../src/torrent.cpp:5908 | pass in ec along with the alert |
pass in ec along with the alert../src/torrent.cpp:5908
+ | ||
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>())
@@ -684,7 +384,7 @@ in the torrent. That should be taken into account here.../src/piece_pic
{
std::set<peer_connection*>::iterator p = i++;
(*p)->disconnect_if_redundant();
- | ||
relevance 2 | ../src/torrent.cpp:8240 | will pick_pieces ever return an empty set? |
will pick_pieces ever return an empty set?../src/torrent.cpp:8240 if (added_request)
+ | ||
relevance 2 | ../src/torrent.cpp:8288 | will pick_pieces ever return an empty set? |
will pick_pieces ever return an empty set?../src/torrent.cpp:8288 if (added_request)
{
peers_with_requests.insert(peers_with_requests.begin(), &c);
if (i->first_requested == min_time()) i->first_requested = now;
@@ -735,7 +435,7 @@ in the torrent. That should be taken into account here.../src/piece_pic
{
std::list<web_seed_entry>::iterator i = std::find_if(m_web_seeds.begin(), m_web_seeds.end()
, (boost::bind(&web_seed_entry::url, _1)
- | ||
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,
+ | ||
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
@@ -786,7 +486,7 @@ in the torrent. That should be taken into account here.../src/piece_pic
// 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)
@@ -839,7 +539,7 @@ 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,
+ | ||
relevance 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"]];
@@ -883,7 +583,7 @@ m_replies_bytes_sent[e["r"]] += int(m_send_buf.size());../src/kademlia/
}}
- | ||
relevance 2 | ../src/kademlia/node.cpp:63 | make this configurable in dht_settings |
make this configurable in dht_settings../src/kademlia/node.cpp:63#include "libtorrent/alert.hpp"
+ | ||
relevance 2 | ../src/kademlia/node.cpp:63 | make this configurable in dht_settings |
make this configurable in dht_settings../src/kademlia/node.cpp:63#include "libtorrent/alert.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/random.hpp"
#include "libtorrent/aux_/session_impl.hpp"
@@ -934,7 +634,58 @@ void purge_peers(std::set<peer_entry>& peers)
void nop() {}
- | ||
relevance 2 | ../include/libtorrent/torrent_info.hpp:468 | 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:468 std::vector<announce_entry> m_urls;
+ | ||
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:654 | 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:654 std::vector<announce_entry> m_urls;
std::vector<web_seed_entry> m_web_seeds;
nodes_t m_nodes;
@@ -985,7 +736,58 @@ void nop() {}
// 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 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 2 | ../include/libtorrent/upnp.hpp:102 | make this a shared_ptr instead |
make this a shared_ptr instead../include/libtorrent/upnp.hpp:102 {
+ 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 };
+ 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 discover_device();
+ void close();
+
+ std::string router_model()
+ {
+ mutex::scoped_lock l(m_mutex);
+ return m_model;
+ }
+
+private:
+
+ void discover_device_impl(mutex::scoped_lock& l);
+ static address_v4 upnp_multicast_address;
+ static udp::endpoint upnp_multicast_endpoint;
+
+ | ||
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
{
@@ -1037,8 +839,8 @@ the chunk headers should be subtracted from the receive_buffer_size../s
std::string request;
request.reserve(400);
- | ||
relevance 1 | ../src/peer_connection.cpp:2519 | 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:2519 }
+ | ||
relevance 1 | ../src/peer_connection.cpp:2549 | 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:2549 }
if (is_disconnecting()) return;
@@ -1089,8 +891,8 @@ all completed disk operations../src/peer_connection.cpp:2519 | ||
relevance 1 | ../src/session_impl.cpp:5517 | 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:5517 void session_impl::on_port_mapping(int mapping, address const& ip, int port
+ | ||
relevance 1 | ../src/session_impl.cpp:5537 | 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:5537 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());
@@ -1141,7 +943,7 @@ this understanding of our external address, instead of the empty address | ||
relevance 1 | ../src/session_impl.cpp:5727 | report errors as alerts |
report errors as alerts../src/session_impl.cpp:5727 }
+ | ||
relevance 1 | ../src/session_impl.cpp:5747 | report errors as alerts |
report errors as alerts../src/session_impl.cpp:5747 }
void session_impl::add_dht_router(std::pair<std::string, int> const& node)
{
@@ -1192,9 +994,9 @@ this understanding of our external address, instead of the empty address | ||
relevance 1 | ../src/session_impl.cpp:6196 | 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:6216 | 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:6196 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:6216 void session_impl::set_external_address(address const& ip
, int source_type, address const& source)
{
#if defined TORRENT_VERBOSE_LOGGING
@@ -1245,11 +1047,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:1167 | 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:1168 | 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:1167 if (c) c->disconnect(errors::no_memory);
+up to the highest written piece in each file../src/torrent.cpp:1168 if (c) c->disconnect(errors::no_memory);
return;
}
@@ -1300,8 +1102,8 @@ up to the highest written piece in each file../src/torrent.cpp:1167 | ||
relevance 1 | ../src/torrent.cpp:5411 | 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:5411 ? (1 << k) : 0;
+ | ||
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;
bitmask.append(1, v);
TORRENT_ASSERT(bits == 8 || j == num_bitmask_bytes - 1);
}
@@ -1352,8 +1154,8 @@ it may pose an issue when downgrading though../src/torrent.cpp:5411 | ||
relevance 1 | ../src/torrent.cpp:6051 | 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:6051 if (m_ses.is_aborted())
+ | ||
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;
@@ -1404,9 +1206,9 @@ i.e. the one that has waited the longest to connect.../src/torrent.cpp:
{
boost::shared_ptr<peer_plugin> pp((*i)->new_connection(p));
if (pp) p->add_extension(pp);
- | ||
relevance 1 | ../src/torrent.cpp:6292 | 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: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
not just seeds. It would be pretty expensive to check all pieces
-for all peers though../src/torrent.cpp:6292 TORRENT_ASSERT(is_finished());
+for all peers though../src/torrent.cpp:6318 TORRENT_ASSERT(is_finished());
TORRENT_ASSERT(m_state != torrent_status::finished && m_state != torrent_status::seeding);
set_state(torrent_status::finished);
@@ -1457,7 +1259,7 @@ for all peers though../src/torrent.cpp:6292relevance 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];
@@ -1508,7 +1310,7 @@ for all peers though../src/torrent.cpp:6292relevance 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)
@@ -1558,7 +1360,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;
@@ -1610,7 +1412,7 @@ this check can be removed as well../src/torrent_info.cpp:416 | ||
relevance 1 | ../src/kademlia/node.cpp:699 | find_node should write directly to the response entry |
find_node should write directly to the response entry../src/kademlia/node.cpp:699 {
+ | ||
relevance 1 | ../src/kademlia/node.cpp:699 | find_node should write directly to the response entry |
find_node should write directly to the response entry../src/kademlia/node.cpp:699 {
TORRENT_LOG(node) << " values: " << reply["values"].list().size();
}
#endif
@@ -1661,7 +1463,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;
};
@@ -1688,7 +1490,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: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()
, end(buffers.end()); i != end; ++i)
{
using asio::buffer_cast;
@@ -1739,7 +1541,7 @@ 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
+ | ||
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:
@@ -1790,7 +1592,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();
@@ -1841,7 +1643,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
+ | ||
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);
@@ -1892,7 +1694,7 @@ use allocate_disk_receive_buffer and release_disk_receive_buffer../incl
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: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';
else bitfield_string[k] = '0';
}
peer_log("==> BITFIELD [ %s ]", bitfield_string.c_str());
@@ -1943,7 +1745,7 @@ 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
+ | ||
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();
i != m_payloads.end(); ++i)
{
@@ -1995,7 +1797,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;
@@ -2046,7 +1848,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
@@ -2097,7 +1899,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:172 | 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:172 {
+ | ||
relevance 0 | ../src/i2p_stream.cpp:172 | 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:172 {
m_state = sam_idle;
std::string name = m_sam_socket->name_lookup();
@@ -2148,7 +1950,7 @@ remove all payload ranges that has been sent../src/bt_peer_connection.c
// send hello command
m_state = read_hello_response;
- | ||
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);
@@ -2199,9 +2001,9 @@ 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:2682 | 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:2712 | 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:2682
+we can construct a full bitfield../src/peer_connection.cpp:2712
#ifdef TORRENT_VERBOSE_LOGGING
peer_log("*** THIS IS A SEED [ p: %p ]", m_peer_info);
#endif
@@ -2252,7 +2054,7 @@ we can construct a full bitfield../src/peer_connection.cpp:2682 | ||
relevance 0 | ../src/peer_connection.cpp:2813 | sort the allowed fast set in priority order |
sort the allowed fast set in priority order../src/peer_connection.cpp:2813 // this piece index later
+ | ||
relevance 0 | ../src/peer_connection.cpp:2843 | sort the allowed fast set in priority order |
sort the allowed fast set in priority order../src/peer_connection.cpp:2843 // this piece index later
m_allowed_fast.push_back(index);
// if the peer has the piece and we want
@@ -2285,6 +2087,10 @@ we can construct a full bitfield../src/peer_connection.cpp:2682../src/peer_connection.cpp:2682 | ||
relevance 0 | ../src/peer_connection.cpp:3925 | we should probably just send a HAVE_ALL here |
we should probably just send a HAVE_ALL here../src/peer_connection.cpp:3925 std::fill(m_recv_buffer.begin() + m_recv_pos, m_recv_buffer.end(), 0);
+ | ||
relevance 0 | ../src/peer_connection.cpp:3959 | we should probably just send a HAVE_ALL here |
we should probably just send a HAVE_ALL here../src/peer_connection.cpp:3959 std::fill(m_recv_buffer.begin() + m_recv_pos, m_recv_buffer.end(), 0);
#endif
m_packet_size = packet_size;
@@ -2354,8 +2156,8 @@ we can construct a full bitfield../src/peer_connection.cpp:2682 | ||
relevance 0 | ../src/peer_connection.cpp:4509 | 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:4509 // this means we're in seed mode and we haven't yet
+ | ||
relevance 0 | ../src/peer_connection.cpp:4543 | 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:4543 // 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);
@@ -2406,7 +2208,7 @@ all completed disk operations../src/peer_connection.cpp:4509 | ||
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";
@@ -2458,7 +2260,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/policy.cpp:1895 | 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:1895#endif
+ | ||
relevance 0 | ../src/policy.cpp:1895 | 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:1895#endif
, on_parole(false)
, banned(false)
#ifndef TORRENT_DISABLE_DHT
@@ -2509,7 +2311,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:1898 | recalculate all connect candidates for all torrents |
|
recalculate all connect candidates for all torrents../src/session_impl.cpp:1898 m_upload_rate.close();
+ | ||
relevance 0 | ../src/session_impl.cpp:1902 | recalculate all connect candidates for all torrents |
recalculate all connect candidates for all torrents../src/session_impl.cpp:1902 m_upload_rate.close();
// #error closing the udp socket here means that
// the uTP connections cannot be closed gracefully
@@ -2560,7 +2362,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:3252 | 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:3252 // --------------------------------------------------------------
+ | ||
relevance 0 | ../src/session_impl.cpp:3262 | 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:3262 // --------------------------------------------------------------
if (!m_paused) m_auto_manage_time_scaler--;
if (m_auto_manage_time_scaler < 0)
{
@@ -2611,7 +2413,7 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:4312 | allow extensions to sort torrents for queuing |
|
allow extensions to sort torrents for queuing../src/session_impl.cpp:4312 else if (!t->is_paused())
+ | ||
relevance 0 | ../src/session_impl.cpp:4322 | allow extensions to sort torrents for queuing |
allow extensions to sort torrents for queuing../src/session_impl.cpp:4322 else if (!t->is_paused())
{
TORRENT_ASSERT(t->m_resume_data_loaded || !t->valid_metadata());
--hard_limit;
@@ -2662,9 +2464,9 @@ override at a time../src/policy.cpp:857relevance 0 | ../src/session_impl.cpp:4468 | 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:4478 | 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:4468 {
+connections../src/session_impl.cpp:4478 {
if (m_boost_connections > max_connections)
{
m_boost_connections -= max_connections;
@@ -2715,7 +2517,7 @@ connections../src/session_impl.cpp:4468relevance 0 | ../src/session_impl.cpp:4502 | make this bias configurable |
|
make this bias configurable../src/session_impl.cpp:4502 | ||
relevance 0 | ../src/session_impl.cpp:4503 | 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:4503 average_peers = num_downloads_peers / num_downloads;
+ | ||
relevance 0 | ../src/session_impl.cpp:4512 | make this bias configurable |
make this bias configurable../src/session_impl.cpp:4512 | ||
relevance 0 | ../src/session_impl.cpp:4513 | 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:4513 average_peers = num_downloads_peers / num_downloads;
if (m_next_connect_torrent == m_torrents.end())
m_next_connect_torrent = m_torrents.begin();
@@ -2766,7 +2568,7 @@ connections../src/session_impl.cpp:4468relevance 0 | ../src/session_impl.cpp:4647 | make configurable |
|
make configurable../src/session_impl.cpp:4647
+ | ||
relevance 0 | ../src/session_impl.cpp:4657 | make configurable |
make configurable../src/session_impl.cpp:4657
#ifdef TORRENT_DEBUG
for (std::vector<peer_connection*>::const_iterator i = peers.begin()
, end(peers.end()), prev(peers.end()); i != end; ++i)
@@ -2799,7 +2601,7 @@ connections../src/session_impl.cpp:4468relevance 0 | ../src/session_impl.cpp:4661 | make configurable |
|
make configurable../src/session_impl.cpp:4661 >= (*i)->uploaded_in_last_round() * 1000
+ | ||
relevance 0 | ../src/session_impl.cpp:4671 | make configurable |
make configurable../src/session_impl.cpp:4671 >= (*i)->uploaded_in_last_round() * 1000
* (1 + t2->priority()) / total_milliseconds(unchoke_interval));
}
prev = i;
@@ -2850,7 +2652,7 @@ connections../src/session_impl.cpp:4468 | ||
relevance 0 | ../src/storage.cpp:326 | if the read fails, set error and exit immediately |
if the read fails, set error and exit immediately../src/storage.cpp:326 if (m_storage->disk_pool()) block_size = m_storage->disk_pool()->block_size();
+ | ||
relevance 0 | ../src/storage.cpp:326 | if the read fails, set error and exit immediately |
if the read fails, set error and exit immediately../src/storage.cpp:326 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;
@@ -2901,7 +2703,7 @@ connections../src/session_impl.cpp:4468relevance 0 | ../src/storage.cpp:360 | if the read fails, set error and exit immediately |
|
if the read fails, set error and exit immediately../src/storage.cpp:360 {
+ | ||
relevance 0 | ../src/storage.cpp:360 | if the read fails, set error and exit immediately |
if the read fails, set error and exit immediately../src/storage.cpp:360 {
ph.h.update((char const*)bufs[i].iov_base, bufs[i].iov_len);
small_piece_size -= bufs[i].iov_len;
}
@@ -2952,7 +2754,7 @@ connections../src/session_impl.cpp:4468relevance 0 | ../src/storage.cpp:638 | 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:638 | 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:638 for (file_iter = files().begin();;)
{
@@ -3005,7 +2807,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:1252 | 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:1252 | 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:1252 int bytes_transferred = 0;
// if the file is opened in no_buffer mode, and the
@@ -3058,12 +2860,68 @@ 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:5144 | 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:1367 | 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:1367 if (pp) p->add_extension(pp);
+ }
+
+ // if files are checked for this torrent, call the extension
+ // to let it initialize itself
+ if (m_connections_initialized)
+ tp->on_files_checked();
+ }
+
+#endif
+
+#ifdef TORRENT_USE_OPENSSL
+
+#if BOOST_VERSION >= 104700
+ bool torrent::verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx)
+ {
+ // if the cert wasn't signed by the correct CA, fail the verification
+ if (!preverified) return false;
+
+ // we're only interested in checking the certificate at the end of the chain.
+ int depth = X509_STORE_CTX_get_error_depth(ctx.native_handle());
+ if (depth > 0) return true;
+
+ X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
+
+ // Go through the alternate names in the certificate looking for matching DNS entries
+ GENERAL_NAMES* gens = static_cast<GENERAL_NAMES*>(
+ X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0));
+
+#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
+ std::string names;
+ bool match = false;
+#endif
+ for (int i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
+ {
+ GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
+ if (gen->type != GEN_DNS) continue;
+ ASN1_IA5STRING* domain = gen->d.dNSName;
+ if (domain->type != V_ASN1_IA5STRING || !domain->data || !domain->length) continue;
+ const char* torrent_name = reinterpret_cast<const char*>(domain->data);
+ std::size_t name_length = domain->length;
+
+#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
+ if (i > 1) names += " | n: ";
+ names.append(torrent_name, name_length);
+#endif
+ if (strncmp(torrent_name, "*", name_length) == 0
+ || strncmp(torrent_name, m_torrent_file->name().c_str(), name_length) == 0)
+ {
+#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
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:5144 if (m_seed_mode) m_verified.resize(m_torrent_file->num_pieces(), false);
+which are kept in sync../src/torrent.cpp:5155 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);
@@ -3114,12 +2972,12 @@ which are kept in sync../src/torrent.cpp:5144relevance 0 | ../src/torrent.cpp:5280 | 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: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
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:5280 add_web_seed(url, web_seed_entry::http_seed);
+no one uses merkle torrents../src/torrent.cpp:5291 add_web_seed(url, web_seed_entry::http_seed);
}
}
@@ -3170,9 +3028,9 @@ no one uses merkle torrents../src/torrent.cpp:5280 | ||
relevance 0 | ../src/torrent.cpp:5468 | 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: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
renamed, but also if they have been merged into a single file for instance.
-using file_base../src/torrent.cpp:5468 entry::string_type& pieces = ret["pieces"].string();
+using file_base../src/torrent.cpp:5479 entry::string_type& pieces = ret["pieces"].string();
pieces.resize(m_torrent_file->num_pieces());
if (is_seed())
{
@@ -3223,10 +3081,10 @@ using file_base../src/torrent.cpp:5468relevance 0 | ../src/torrent.cpp:7945 | 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:7971 | 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:7945 }
+it num_interested == 0, we need to pick a new piece../src/torrent.cpp:7971 }
rarest_pieces.clear();
rarest_rarity = pp.peer_count;
@@ -3277,7 +3135,7 @@ it num_interested == 0, we need to pick a new piece../src/torrent.cpp:7
{
// we don't keep track of availability, do it the expensive way
// do a linear search from the first piece
- | ||
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 }
@@ -3330,7 +3188,7 @@ 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 | ../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
@@ -3380,82 +3238,29 @@ with actual strings. For example i2p trackers../src/udp_tracker_connect
#include <stdarg.h>
-inline int snprintf(char* buf, int len, char const* fmt, ...)
- | ||
relevance 0 | ../include/libtorrent/file.hpp:111 | why are all these functions exported? |
why are all these functions exported?../include/libtorrent/file.hpp:111 time_t ctime;
- enum {
-#if defined TORRENT_WINDOWS
- fifo = 0x1000, // named pipe (fifo)
- character_special = 0x2000, // character special
- directory = 0x4000, // directory
- regular_file = 0x8000 // regular
-#else
- fifo = 0010000, // named pipe (fifo)
- character_special = 0020000, // character special
- directory = 0040000, // directory
- block_special = 0060000, // block special
- regular_file = 0100000, // regular
- link = 0120000, // symbolic link
- socket = 0140000 // socket
-#endif
- } modes_t;
- int mode;
- };
-
- enum stat_flags_t { dont_follow_links = 1 };
- TORRENT_EXPORT void stat_file(std::string f, file_status* s
- , error_code& ec, int flags = 0);
- TORRENT_EXPORT void rename(std::string const& f
- , std::string const& newf, error_code& ec);
- TORRENT_EXPORT void create_directories(std::string const& f
- , error_code& ec);
- TORRENT_EXPORT void create_directory(std::string const& f
- , error_code& ec);
- TORRENT_EXPORT void remove_all(std::string const& f
- , error_code& ec);
- TORRENT_EXPORT void remove(std::string const& f, error_code& ec);
- TORRENT_EXPORT bool exists(std::string const& f);
- TORRENT_EXPORT size_type file_size(std::string const& f);
- TORRENT_EXPORT bool is_directory(std::string const& f
- , error_code& ec);
- TORRENT_EXPORT void recursive_copy(std::string const& old_path
- , std::string const& new_path, error_code& ec);
- TORRENT_EXPORT void copy_file(std::string const& f
- , std::string const& newf, error_code& ec);
-
- TORRENT_EXPORT std::string split_path(std::string const& f);
- TORRENT_EXPORT char const* next_path_element(char const* p);
- TORRENT_EXPORT std::string extension(std::string const& f);
- TORRENT_EXPORT void replace_extension(std::string& f, std::string const& ext);
- TORRENT_EXPORT bool is_root_path(std::string const& f);
- TORRENT_EXPORT std::string parent_path(std::string const& f);
- TORRENT_EXPORT bool has_parent_path(std::string const& f);
- TORRENT_EXPORT std::string filename(std::string const& f);
- TORRENT_EXPORT std::string combine_path(std::string const& lhs
- , std::string const& rhs);
- | ||
relevance 0 | ../include/libtorrent/file_storage.hpp:74 | does this really need to be exported? |
does this really need to be exported?../include/libtorrent/file_storage.hpp:74 std::string path;
- size_type offset; // the offset of this file inside the torrent
- size_type size; // the size of this file
- // the offset in the file where the storage starts.
- // This is always 0 unless parts of the torrent is
- // compressed into a single file, such as a so-called part file.
- size_type file_base;
- std::time_t mtime;
- sha1_hash filehash;
- bool pad_file:1;
+// internal
+ | ||
relevance 0 | ../include/libtorrent/file_storage.hpp:107 | does this really need to be exported? |
does this really need to be exported?../include/libtorrent/file_storage.hpp:107
+ // true if the file was marked as hidden (on windows).
bool hidden_attribute:1;
+
+ // true if the file was marked as executable (posix)
bool executable_attribute:1;
+
+ // true if the file was a symlink. If this is the case
+ // the ``symlink_index`` refers to a string which specifies the original location
+ // where the data for this file was found.
bool symlink_attribute:1;
+
+ // the path which this is a symlink to, or empty if this is
+ // not a symlink. This field is only used if the ``symlink_attribute`` is set.
std::string symlink_path;
};
- // this is used internally to hold the file entry
- // it's smaller and optimized for smaller memory
- // footprint, as opposed to file_entry, which is
- // optimized for convenience
- struct TORRENT_EXPORT internal_file_entry
- {
- friend class file_storage;
-#ifdef TORRENT_DEBUG
+ // internal
+ struct TORRENT_EXPORT internal_file_entry
+ {
+ friend class file_storage;
+ #ifdef TORRENT_DEBUG
// for torrent_info::invariant_check
friend class torrent_info;
#endif
@@ -3483,7 +3288,9 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
, executable_attribute(e.executable_attribute)
, symlink_attribute(e.symlink_attribute)
, path_index(-1)
- | ||
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
+ {
+ set_name(e.path.c_str());
+ | ||
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);
}
@@ -3535,17 +3342,17 @@ 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:110 | 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:110 std::string url;
- std::string trackerid;
-
- // if this tracker has returned an error or warning message
- // that message is stored here
- std::string message;
-
+ | ||
relevance 0 | ../include/libtorrent/torrent_info.hpp:118 | 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:118
// if this tracker failed the last time it was contacted
// this error code specifies what error occurred
error_code last_error;
+ // returns the number of seconds to the next announce on
+ // this tracker. ``min_announce_in()`` returns the number of seconds until we are
+ // allowed to force another tracker update with this tracker.
+ //
+ // If the last time this tracker was contacted failed, ``last_error`` is the error
+ // code describing what error occurred.
int next_announce_in() const;
int min_announce_in() const;
@@ -3556,34 +3363,34 @@ m_sock.bind(endpoint, ec);../include/libtorrent/proxy_base.hpp:152
ptime min_announce;
- // if this tracker has returned scrape data, these fields are filled
+ // these are either -1 or the scrape information this tracker last responded with. *incomplete* is
+ // the current number of downloaders in the swarm, *complete* is the current number
+ // of seeds in the swarm and *downloaded* is the cumulative number of completed
+ // downloads of this torrent, since the beginning of time (from this tracker's point
+ // of view).
+
+ // if this tracker has returned scrape data, these fields are filled
// in with valid numbers. Otherwise they are set to -1.
// the number of current downloaders
int scrape_incomplete;
- // the number of current seeds
int scrape_complete;
- // the cumulative number of completed downloads, ever
int scrape_downloaded;
// the tier this tracker belongs to
boost::uint8_t tier;
- // the number of times this tracker can fail
- // in a row before it's removed. 0 means unlimited
+ // the max number of failures to announce to this tracker in
+ // a row, before this tracker is not used anymore. 0 means unlimited
boost::uint8_t fail_limit;
- // the number of times in a row this tracker has failed
+ // the number of times in a row we have failed to announce to this
+ // tracker.
boost::uint8_t fails:7;
- // true if we're currently trying to announce with
- // this tracker
+ // true while we're waiting for a response from the tracker.
bool updating:1;
+ // flags for the source bitmask, each indicating where
+ // we heard about this tracker
enum tracker_source
- {
- source_torrent = 1,
- source_client = 2,
- source_magnet_link = 4,
- source_tex = 8
- };
| ||