diff --git a/examples/session_view.cpp b/examples/session_view.cpp index 63a4e5277..39e32d476 100644 --- a/examples/session_view.cpp +++ b/examples/session_view.cpp @@ -4,7 +4,8 @@ #include // for std::max session_view::session_view() - : m_print_utp_stats(false) + : m_position(0) + , m_print_utp_stats(false) { using libtorrent::find_metric_idx; diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 32a3820bc..dd45858dc 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -1143,7 +1143,8 @@ namespace libtorrent // shutting down. This list is just here to keep them alive during // whe shutting down process std::list > m_tracker_loggers; - +#endif +#ifdef TORRENT_REQUEST_LOGGING FILE* m_request_logger; #endif diff --git a/include/libtorrent/build_config.hpp b/include/libtorrent/build_config.hpp index 8b6678d51..0b41a66a7 100644 --- a/include/libtorrent/build_config.hpp +++ b/include/libtorrent/build_config.hpp @@ -37,6 +37,10 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +// TODO: 2 instead of using a dummy function to cause link errors when +// incompatible build configurations are used, make the namespace name +// depend on the configuration, and have a using declaration in the headers +// to pull it into libtorrent. #if TORRENT_USE_IPV6 #define TORRENT_CFG_IPV6 ipv6_ #else diff --git a/include/libtorrent/disk_buffer_holder.hpp b/include/libtorrent/disk_buffer_holder.hpp index 93f313df1..6252f4f69 100644 --- a/include/libtorrent/disk_buffer_holder.hpp +++ b/include/libtorrent/disk_buffer_holder.hpp @@ -111,8 +111,9 @@ namespace libtorrent { return m_buf == 0? 0: &disk_buffer_holder::release; } private: - // explicitly disallow assignment, to silence msvc warning + // non-copyable disk_buffer_holder& operator=(disk_buffer_holder const&); + disk_buffer_holder(disk_buffer_holder const*); buffer_allocator_interface& m_allocator; char* m_buf; diff --git a/include/libtorrent/http_tracker_connection.hpp b/include/libtorrent/http_tracker_connection.hpp index 48e7d0fe8..43f5f1848 100644 --- a/include/libtorrent/http_tracker_connection.hpp +++ b/include/libtorrent/http_tracker_connection.hpp @@ -70,8 +70,7 @@ namespace libtorrent io_service& ios , tracker_manager& man , tracker_request const& req - , boost::weak_ptr c - ); + , boost::weak_ptr c); void start(); void close(); diff --git a/include/libtorrent/network_thread_pool.hpp b/include/libtorrent/network_thread_pool.hpp index 88821323c..577fc0857 100644 --- a/include/libtorrent/network_thread_pool.hpp +++ b/include/libtorrent/network_thread_pool.hpp @@ -45,12 +45,13 @@ namespace libtorrent struct socket_job { - socket_job() : vec(NULL), recv_buf(NULL), buf_size(0) {} + socket_job() : vec(NULL), recv_buf(NULL), buf_size(0), type(none) {} enum job_type_t { read_job = 0, - write_job + write_job, + none }; job_type_t type; diff --git a/include/libtorrent/pe_crypto.hpp b/include/libtorrent/pe_crypto.hpp index 057cb34f7..b515bfd79 100644 --- a/include/libtorrent/pe_crypto.hpp +++ b/include/libtorrent/pe_crypto.hpp @@ -121,12 +121,9 @@ namespace libtorrent struct TORRENT_EXTRA_EXPORT rc4_handler : crypto_plugin { public: - // Input longkeys must be 20 bytes - rc4_handler() - : m_encrypt(false) - , m_decrypt(false) - {} + rc4_handler(); + // Input keys must be 20 bytes void set_incoming_key(unsigned char const* key, int len); void set_outgoing_key(unsigned char const* key, int len); diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index f430f983e..5fe62a336 100644 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -186,7 +186,6 @@ namespace libtorrent , int flags = start_default_features | add_default_plugins) { TORRENT_CFG(); - init(); start(flags, pack); } session(fingerprint const& print = fingerprint("LT" @@ -196,6 +195,9 @@ namespace libtorrent { TORRENT_CFG(); settings_pack pack; + // TODO: 2 the two second constructors here should probably + // be deprecated in favor of the more generic one that just + // takes a settings_pack and a string pack.set_int(settings_pack::alert_mask, alert_mask); pack.set_str(settings_pack::peer_fingerprint, print.to_string()); if ((flags & start_default_features) == 0) @@ -206,7 +208,6 @@ namespace libtorrent pack.set_bool(settings_pack::enable_dht, false); } - init(); start(flags, pack); } session(fingerprint const& print @@ -234,7 +235,6 @@ namespace libtorrent pack.set_bool(settings_pack::enable_lsd, false); pack.set_bool(settings_pack::enable_dht, false); } - init(); start(flags, pack); } @@ -1218,7 +1218,6 @@ namespace libtorrent private: - void init(); void start(int flags, settings_pack const& pack); // data shared between the main thread diff --git a/src/disk_buffer_holder.cpp b/src/disk_buffer_holder.cpp index 43e0c5405..03871c3d9 100644 --- a/src/disk_buffer_holder.cpp +++ b/src/disk_buffer_holder.cpp @@ -41,6 +41,8 @@ namespace libtorrent : m_allocator(alloc), m_buf(buf) { m_ref.storage = 0; + m_ref.piece = -1; + m_ref.block = -1; } disk_buffer_holder::disk_buffer_holder(buffer_allocator_interface& alloc, disk_io_job const& j) diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index 4675950fa..5fd880456 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -74,6 +74,9 @@ namespace libtorrent , boost::weak_ptr c) : tracker_connection(man, req, ios, c) , m_man(man) +#if TORRENT_USE_I2P + , m_i2p_conn(NULL) +#endif {} void http_tracker_connection::start() diff --git a/src/i2p_stream.cpp b/src/i2p_stream.cpp index c9ff5bb29..1fe27dbaf 100644 --- a/src/i2p_stream.cpp +++ b/src/i2p_stream.cpp @@ -92,7 +92,8 @@ namespace libtorrent } i2p_connection::i2p_connection(io_service& ios) - : m_state(sam_idle) + : m_port(0) + , m_state(sam_idle) , m_io_service(ios) {} diff --git a/src/pe_crypto.cpp b/src/pe_crypto.cpp index ba4b3d7a2..7c5923ab2 100644 --- a/src/pe_crypto.cpp +++ b/src/pe_crypto.cpp @@ -264,6 +264,16 @@ namespace libtorrent recv_buffer.crypto_reset(packet_size); } + rc4_handler::rc4_handler() + : m_encrypt(false) + , m_decrypt(false) + { + m_rc4_incoming.x = 0; + m_rc4_incoming.y = 0; + m_rc4_outgoing.x = 0; + m_rc4_outgoing.y = 0; + } + void rc4_handler::set_incoming_key(unsigned char const* key, int len) { m_decrypt = true; diff --git a/src/session.cpp b/src/session.cpp index 93bd8f2d5..9193bb427 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -388,7 +388,7 @@ namespace libtorrent { throw; } #endif - void session::init() + void session::start(int flags, settings_pack const& pack) { #if defined _MSC_VER && defined TORRENT_DEBUG // workaround for microsofts @@ -398,10 +398,6 @@ namespace libtorrent #endif m_impl.reset(new session_impl()); - } - - void session::start(int flags, settings_pack const& pack) - { #ifndef TORRENT_DISABLE_EXTENSIONS if (flags & add_default_plugins) { diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 41aea259f..b85ffedd2 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -357,6 +357,9 @@ namespace aux { #else , m_upload_rate(peer_connection::upload_channel) #endif + , m_global_class(0) + , m_tcp_peer_class(0) + , m_local_peer_class(0) , m_tracker_manager(m_udp_socket, m_stats_counters, m_host_resolver , m_ip_filter, m_settings #if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS @@ -392,6 +395,7 @@ namespace aux { #ifndef TORRENT_NO_DEPRECATE , m_next_rss_update(min_time()) #endif + , m_next_port(0) #ifndef TORRENT_DISABLE_DHT , m_dht_announce_timer(m_io_service) , m_dht_interval_update_torrents(0) @@ -410,7 +414,10 @@ namespace aux { , m_timer(m_io_service) , m_lsd_announce_timer(m_io_service) , m_host_resolver(m_io_service) + , m_next_downloading_connect_torrent(0) + , m_next_finished_connect_torrent(0) , m_download_connect_attempts(0) + , m_next_scrape_torrent(0) , m_tick_residual(0) , m_deferred_submit_disk_jobs(false) , m_pending_auto_manage(false) @@ -435,6 +442,8 @@ namespace aux { m_ssl_udp_socket.subscribe(this); #endif + // TODO: 3 remove REQUESST_LOGGING build configuration. Make sure the + // same information can be logged via alerts #ifdef TORRENT_REQUEST_LOGGING char log_filename[200]; #ifdef TORRENT_WINDOWS @@ -478,10 +487,6 @@ namespace aux { m_next_dht_torrent = m_torrents.begin(); #endif m_next_lsd_torrent = m_torrents.begin(); - m_next_downloading_connect_torrent = 0; - m_next_finished_connect_torrent = 0; - m_next_scrape_torrent = 0; - m_tcp_mapping[0] = -1; m_tcp_mapping[1] = -1; m_udp_mapping[0] = -1; diff --git a/src/torrent.cpp b/src/torrent.cpp index c6f4c3138..126316160 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -134,6 +134,8 @@ namespace libtorrent { peer_info.web_seed = true; restart_request.piece = -1; + restart_request.start = -1; + restart_request.length = -1; } web_seed_t::web_seed_t(std::string const& url_, web_seed_entry::type_t type_ @@ -148,6 +150,8 @@ namespace libtorrent { peer_info.web_seed = true; restart_request.piece = -1; + restart_request.start = -1; + restart_request.length = -1; } #ifndef TORRENT_DISABLE_EXTENSIONS @@ -266,6 +270,7 @@ namespace libtorrent , m_downloaded(0xffffff) , m_last_scrape((std::numeric_limits::min)()) , m_progress_ppm(0) + , m_last_active_change(0) , m_use_resume_save_path(p.flags & add_torrent_params::flag_use_resume_save_path) { if (m_pinned)