refactor to use std::shared_ptr with peer_connection, core and tests (#1050)

This commit is contained in:
Alden Torres 2016-08-31 21:42:18 -04:00 committed by Arvid Norberg
parent 6e891a0211
commit bf0008933a
68 changed files with 264 additions and 365 deletions

View File

@ -1,3 +1,4 @@
* source code migration from boost::shared_ptr to std::shared_ptr
* storage_interface API changed to use span and references * storage_interface API changed to use span and references
* changes in public API to work with std::shared_ptr<torrent_info> * changes in public API to work with std::shared_ptr<torrent_info>
* extensions API changed to use span and std::shared_ptr * extensions API changed to use span and std::shared_ptr

View File

@ -60,7 +60,7 @@ namespace
int add_handle(libtorrent::torrent_handle const& h) int add_handle(libtorrent::torrent_handle const& h)
{ {
std::vector<libtorrent::torrent_handle>::iterator i = std::find_if(handles.begin() std::vector<libtorrent::torrent_handle>::iterator i = std::find_if(handles.begin()
, handles.end(), !boost::bind(&libtorrent::torrent_handle::is_valid, _1)); , handles.end(), !std::bind(&libtorrent::torrent_handle::is_valid, _1));
if (i != handles.end()) if (i != handles.end())
{ {
*i = h; *i = h;

View File

@ -59,7 +59,7 @@ struct entry_to_python
} }
} }
static PyObject* convert(boost::shared_ptr<entry> const& e) static PyObject* convert(std::shared_ptr<entry> const& e)
{ {
if (!e) if (!e)
return incref(Py_None); return incref(Py_None);
@ -172,7 +172,7 @@ struct entry_from_python
void bind_entry() void bind_entry()
{ {
to_python_converter<boost::shared_ptr<libtorrent::entry>, entry_to_python>(); to_python_converter<std::shared_ptr<libtorrent::entry>, entry_to_python>();
to_python_converter<entry, entry_to_python>(); to_python_converter<entry, entry_to_python>();
entry_from_python(); entry_from_python();
} }

View File

@ -138,11 +138,11 @@ namespace
} }
} }
boost::shared_ptr<lt::session> make_session(boost::python::dict sett, int flags) std::shared_ptr<lt::session> make_session(boost::python::dict sett, int flags)
{ {
settings_pack p; settings_pack p;
make_settings_pack(p, sett); make_settings_pack(p, sett);
return boost::make_shared<lt::session>(p, flags); return std::make_shared<lt::session>(p, flags);
} }
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE

View File

@ -2,12 +2,8 @@
// subject to the Boost Software License, Version 1.0. (See accompanying // subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include "boost_python.hpp" #include "boost_python.hpp"
#include <boost/shared_ptr.hpp> #include <memory>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/torrent_info.hpp" #include "libtorrent/torrent_info.hpp"
#include "libtorrent/session_settings.hpp" #include "libtorrent/session_settings.hpp"
@ -142,39 +138,39 @@ namespace
} // namespace unnamed } // namespace unnamed
boost::shared_ptr<torrent_info> buffer_constructor0(char const* buf, int len, int flags) std::shared_ptr<torrent_info> buffer_constructor0(char const* buf, int len, int flags)
{ {
error_code ec; error_code ec;
boost::shared_ptr<torrent_info> ret(boost::make_shared<torrent_info>(buf std::shared_ptr<torrent_info> ret = std::make_shared<torrent_info>(buf
, len, boost::ref(ec), flags)); , len, ec, flags);
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (ec) throw system_error(ec); if (ec) throw system_error(ec);
#endif #endif
return ret; return ret;
} }
boost::shared_ptr<torrent_info> buffer_constructor1(char const* buf, int len) std::shared_ptr<torrent_info> buffer_constructor1(char const* buf, int len)
{ {
return buffer_constructor0(buf, len, 0); return buffer_constructor0(buf, len, 0);
} }
boost::shared_ptr<torrent_info> file_constructor0(std::string const& filename, int flags) std::shared_ptr<torrent_info> file_constructor0(std::string const& filename, int flags)
{ {
error_code ec; error_code ec;
boost::shared_ptr<torrent_info> ret(boost::make_shared<torrent_info>(filename std::shared_ptr<torrent_info> ret = std::make_shared<torrent_info>(filename
, boost::ref(ec), flags)); , ec, flags);
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (ec) throw system_error(ec); if (ec) throw system_error(ec);
#endif #endif
return ret; return ret;
} }
boost::shared_ptr<torrent_info> file_constructor1(std::string const& filename) std::shared_ptr<torrent_info> file_constructor1(std::string const& filename)
{ {
return file_constructor0(filename, 0); return file_constructor0(filename, 0);
} }
boost::shared_ptr<torrent_info> bencoded_constructor0(entry const& ent, int flags) std::shared_ptr<torrent_info> bencoded_constructor0(entry const& ent, int flags)
{ {
std::vector<char> buf; std::vector<char> buf;
bencode(std::back_inserter(buf), ent); bencode(std::back_inserter(buf), ent);
@ -188,15 +184,15 @@ boost::shared_ptr<torrent_info> bencoded_constructor0(entry const& ent, int flag
#endif #endif
} }
boost::shared_ptr<torrent_info> ret(boost::make_shared<torrent_info>(e std::shared_ptr<torrent_info> ret = std::make_shared<torrent_info>(e
, boost::ref(ec), flags)); , ec, flags);
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (ec) throw system_error(ec); if (ec) throw system_error(ec);
#endif #endif
return ret; return ret;
} }
boost::shared_ptr<torrent_info> bencoded_constructor1(entry const& ent) std::shared_ptr<torrent_info> bencoded_constructor1(entry const& ent)
{ {
return bencoded_constructor0(ent, 0); return bencoded_constructor0(ent, 0);
} }
@ -216,7 +212,7 @@ void bind_torrent_info()
.def_readwrite("size", &file_slice::size) .def_readwrite("size", &file_slice::size)
; ;
class_<torrent_info, boost::shared_ptr<torrent_info> >("torrent_info", no_init) class_<torrent_info, std::shared_ptr<torrent_info> >("torrent_info", no_init)
.def(init<sha1_hash const&, int>((arg("info_hash"), arg("flags") = 0))) .def(init<sha1_hash const&, int>((arg("info_hash"), arg("flags") = 0)))
.def("__init__", make_constructor(&bencoded_constructor0)) .def("__init__", make_constructor(&bencoded_constructor0))
.def("__init__", make_constructor(&bencoded_constructor1)) .def("__init__", make_constructor(&bencoded_constructor1))
@ -314,10 +310,8 @@ void bind_torrent_info()
.value("source_tex", announce_entry::source_tex) .value("source_tex", announce_entry::source_tex)
; ;
#if BOOST_VERSION > 104200 implicitly_convertible<std::shared_ptr<torrent_info>, std::shared_ptr<const torrent_info>>();
implicitly_convertible<boost::shared_ptr<torrent_info>, boost::shared_ptr<const torrent_info> >(); boost::python::register_ptr_to_python<std::shared_ptr<const torrent_info>>();
boost::python::register_ptr_to_python<boost::shared_ptr<const torrent_info> >();
#endif
} }
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -215,7 +215,7 @@ The save_resume_data_alert_ looks something like this:
virtual std::string message() const; virtual std::string message() const;
// points to the resume data. // points to the resume data.
boost::shared_ptr<entry> resume_data; std::shared_ptr<entry> resume_data;
}; };
``resume_data`` points to an entry_ object. This represents a node or a tree of ``resume_data`` points to an entry_ object. This represents a node or a tree of

View File

@ -989,7 +989,7 @@ namespace libtorrent
{ {
// internal // internal
save_resume_data_alert(aux::stack_allocator& alloc save_resume_data_alert(aux::stack_allocator& alloc
, boost::shared_ptr<entry> const& rd , std::shared_ptr<entry> const& rd
, torrent_handle const& h); , torrent_handle const& h);
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37) TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37)
@ -998,7 +998,7 @@ namespace libtorrent
virtual std::string message() const override; virtual std::string message() const override;
// points to the resume data. // points to the resume data.
boost::shared_ptr<entry> resume_data; std::shared_ptr<entry> resume_data;
}; };
// This alert is generated instead of ``save_resume_data_alert`` if there was an error // This alert is generated instead of ``save_resume_data_alert`` if there was an error
@ -1170,7 +1170,7 @@ namespace libtorrent
// //
// torrent_handle h = alert->handle(); // torrent_handle h = alert->handle();
// if (h.is_valid()) { // if (h.is_valid()) {
// boost::shared_ptr<torrent_info const> ti = h.torrent_file(); // std::shared_ptr<torrent_info const> ti = h.torrent_file();
// create_torrent ct(*ti); // create_torrent ct(*ti);
// entry te = ct.generate(); // entry te = ct.generate();
// std::vector<char> buffer; // std::vector<char> buffer;

View File

@ -203,7 +203,7 @@ namespace libtorrent
#if TORRENT_USE_INVARIANT_CHECKS #if TORRENT_USE_INVARIANT_CHECKS
friend class libtorrent::invariant_access; friend class libtorrent::invariant_access;
#endif #endif
typedef std::set<boost::shared_ptr<peer_connection>> connection_map; typedef std::set<std::shared_ptr<peer_connection>> connection_map;
typedef std::unordered_map<sha1_hash, std::shared_ptr<torrent>> torrent_map; typedef std::unordered_map<sha1_hash, std::shared_ptr<torrent>> torrent_map;
session_impl(io_service& ios); session_impl(io_service& ios);
@ -311,7 +311,7 @@ namespace libtorrent
libtorrent::session_settings deprecated_settings() const; libtorrent::session_settings deprecated_settings() const;
#endif #endif
void apply_settings_pack(boost::shared_ptr<settings_pack> pack) override; void apply_settings_pack(std::shared_ptr<settings_pack> pack) override;
void apply_settings_pack_impl(settings_pack const& pack void apply_settings_pack_impl(settings_pack const& pack
, bool const init = false); , bool const init = false);
session_settings const& settings() const override { return m_settings; } session_settings const& settings() const override { return m_settings; }
@ -395,7 +395,7 @@ namespace libtorrent
void pause(); void pause();
void resume(); void resume();
void set_ip_filter(boost::shared_ptr<ip_filter> const& f); void set_ip_filter(std::shared_ptr<ip_filter> const& f);
ip_filter const& get_ip_filter(); ip_filter const& get_ip_filter();
void set_port_filter(port_filter const& f); void set_port_filter(port_filter const& f);
@ -531,7 +531,7 @@ namespace libtorrent
void load_state(bdecode_node const* e, std::uint32_t flags); void load_state(bdecode_node const* e, std::uint32_t flags);
bool has_connection(peer_connection* p) const override; bool has_connection(peer_connection* p) const override;
void insert_peer(boost::shared_ptr<peer_connection> const& c) override; void insert_peer(std::shared_ptr<peer_connection> const& c) override;
proxy_settings proxy() const override; proxy_settings proxy() const override;
@ -602,7 +602,7 @@ namespace libtorrent
void free_disk_buffer(char* buf) override; void free_disk_buffer(char* buf) override;
disk_buffer_holder allocate_disk_buffer(char const* category) override; disk_buffer_holder allocate_disk_buffer(char const* category) override;
disk_buffer_holder allocate_disk_buffer(bool& exceeded disk_buffer_holder allocate_disk_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o , std::shared_ptr<disk_observer> o
, char const* category) override; , char const* category) override;
void reclaim_block(block_cache_reference ref) override; void reclaim_block(block_cache_reference ref) override;
@ -719,7 +719,7 @@ namespace libtorrent
peer_class_pool m_classes; peer_class_pool m_classes;
void init(boost::shared_ptr<settings_pack> pack); void init(std::shared_ptr<settings_pack> pack);
void submit_disk_jobs(); void submit_disk_jobs();
@ -827,7 +827,7 @@ namespace libtorrent
// once a peer is disconnected, it's put in this list and // once a peer is disconnected, it's put in this list and
// every second their refcount is checked, and if it's 1, // every second their refcount is checked, and if it's 1,
// they are deleted (from the network thread) // they are deleted (from the network thread)
std::vector<boost::shared_ptr<peer_connection>> m_undead_peers; std::vector<std::shared_ptr<peer_connection>> m_undead_peers;
// keep the io_service alive until we have posted the job // keep the io_service alive until we have posted the job
// to clear the undead peers // to clear the undead peers
@ -853,7 +853,7 @@ namespace libtorrent
peer_class_type_filter m_peer_class_type_filter; peer_class_type_filter m_peer_class_type_filter;
// filters incoming connections // filters incoming connections
boost::shared_ptr<ip_filter> m_ip_filter; std::shared_ptr<ip_filter> m_ip_filter;
// filters outgoing connections // filters outgoing connections
port_filter m_port_filter; port_filter m_port_filter;
@ -1173,7 +1173,7 @@ namespace libtorrent
// this list of tracker loggers serves as tracker_callbacks when // this list of tracker loggers serves as tracker_callbacks when
// shutting down. This list is just here to keep them alive during // shutting down. This list is just here to keep them alive during
// whe shutting down process // whe shutting down process
std::list<boost::shared_ptr<tracker_logger> > m_tracker_loggers; std::list<std::shared_ptr<tracker_logger>> m_tracker_loggers;
#endif #endif
// state for keeping track of external IPs // state for keeping track of external IPs

View File

@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/disk_buffer_holder.hpp" #include "libtorrent/disk_buffer_holder.hpp"
#include <functional> #include <functional>
#include <memory>
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
#include "libtorrent/socket.hpp" #include "libtorrent/socket.hpp"
@ -49,12 +50,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/weak_ptr.hpp>
#ifndef TORRENT_DISABLE_LOGGING
#include <boost/shared_ptr.hpp>
#endif
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
#include <boost/asio/ssl/context.hpp> #include <boost/asio/ssl/context.hpp>
#endif #endif
@ -164,7 +159,7 @@ namespace libtorrent { namespace aux
, callback_t const& h) = 0; , callback_t const& h) = 0;
virtual bool has_connection(peer_connection* p) const = 0; virtual bool has_connection(peer_connection* p) const = 0;
virtual void insert_peer(boost::shared_ptr<peer_connection> const& c) = 0; virtual void insert_peer(std::shared_ptr<peer_connection> const& c) = 0;
virtual void evict_torrent(torrent* t) = 0; virtual void evict_torrent(torrent* t) = 0;
@ -248,7 +243,7 @@ namespace libtorrent { namespace aux
virtual void trigger_auto_manage() = 0; virtual void trigger_auto_manage() = 0;
virtual void apply_settings_pack(boost::shared_ptr<settings_pack> pack) = 0; virtual void apply_settings_pack(std::shared_ptr<settings_pack> pack) = 0;
virtual session_settings const& settings() const = 0; virtual session_settings const& settings() const = 0;
virtual void queue_tracker_request(tracker_request& req virtual void queue_tracker_request(tracker_request& req

View File

@ -33,11 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_BANDWIDTH_MANAGER_HPP_INCLUDED #ifndef TORRENT_BANDWIDTH_MANAGER_HPP_INCLUDED
#define TORRENT_BANDWIDTH_MANAGER_HPP_INCLUDED #define TORRENT_BANDWIDTH_MANAGER_HPP_INCLUDED
#include "libtorrent/aux_/disable_warnings_push.hpp" #include <memory>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/socket.hpp" #include "libtorrent/socket.hpp"
#include "libtorrent/error_code.hpp" #include "libtorrent/error_code.hpp"
@ -68,7 +64,7 @@ struct TORRENT_EXTRA_EXPORT bandwidth_manager
// this is used by web seeds // this is used by web seeds
// returns the number of bytes to assign to the peer, or 0 // returns the number of bytes to assign to the peer, or 0
// if the peer's 'assign_bandwidth' callback will be called later // if the peer's 'assign_bandwidth' callback will be called later
int request_bandwidth(boost::shared_ptr<bandwidth_socket> const& peer int request_bandwidth(std::shared_ptr<bandwidth_socket> const& peer
, int blk, int priority, bandwidth_channel** chan, int num_channels); , int blk, int priority, bandwidth_channel** chan, int num_channels);
#if TORRENT_USE_INVARIANT_CHECKS #if TORRENT_USE_INVARIANT_CHECKS

View File

@ -33,9 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED #ifndef TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED
#define TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED #define TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED
#include "libtorrent/aux_/disable_warnings_push.hpp" #include <memory>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/bandwidth_limit.hpp" #include "libtorrent/bandwidth_limit.hpp"
#include "libtorrent/bandwidth_socket.hpp" #include "libtorrent/bandwidth_socket.hpp"
@ -44,10 +42,10 @@ namespace libtorrent {
struct TORRENT_EXTRA_EXPORT bw_request struct TORRENT_EXTRA_EXPORT bw_request
{ {
bw_request(boost::shared_ptr<bandwidth_socket> const& pe bw_request(std::shared_ptr<bandwidth_socket> const& pe
, int blk, int prio); , int blk, int prio);
boost::shared_ptr<bandwidth_socket> peer; std::shared_ptr<bandwidth_socket> peer;
// 1 is normal prio // 1 is normal prio
int priority; int priority;
// the number of bytes assigned to this request so far // the number of bytes assigned to this request so far

View File

@ -39,10 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/address.hpp" #include "libtorrent/address.hpp"
#include "libtorrent/error_code.hpp" #include "libtorrent/error_code.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp" #include <memory>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <list> #include <list>
namespace libtorrent namespace libtorrent
@ -82,12 +79,12 @@ namespace libtorrent
struct socket_entry struct socket_entry
{ {
socket_entry(boost::shared_ptr<udp::socket> const& s) socket_entry(std::shared_ptr<udp::socket> const& s)
: socket(s), broadcast(false) { memset(buffer, 0, sizeof(buffer)); } : socket(s), broadcast(false) { std::memset(buffer, 0, sizeof(buffer)); }
socket_entry(boost::shared_ptr<udp::socket> const& s socket_entry(std::shared_ptr<udp::socket> const& s
, address_v4 const& mask): socket(s), netmask(mask), broadcast(false) , address_v4 const& mask): socket(s), netmask(mask), broadcast(false)
{ memset(buffer, 0, sizeof(buffer)); } { std::memset(buffer, 0, sizeof(buffer)); }
boost::shared_ptr<udp::socket> socket; std::shared_ptr<udp::socket> socket;
char buffer[1500]; char buffer[1500];
udp::endpoint remote; udp::endpoint remote;
address_v4 netmask; address_v4 netmask;

View File

@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/scoped_array.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/aux_/disable_warnings_pop.hpp"

View File

@ -37,11 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/assert.hpp" #include "libtorrent/assert.hpp"
#include "libtorrent/disk_io_job.hpp" // for block_cache_reference #include "libtorrent/disk_io_job.hpp" // for block_cache_reference
#include "libtorrent/aux_/disable_warnings_push.hpp" #include <memory>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
namespace libtorrent namespace libtorrent
{ {
@ -55,7 +51,7 @@ namespace libtorrent
virtual void reclaim_block(block_cache_reference ref) = 0; virtual void reclaim_block(block_cache_reference ref) = 0;
virtual disk_buffer_holder allocate_disk_buffer(char const* category) = 0; virtual disk_buffer_holder allocate_disk_buffer(char const* category) = 0;
virtual disk_buffer_holder allocate_disk_buffer(bool& exceeded virtual disk_buffer_holder allocate_disk_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o , std::shared_ptr<disk_observer> o
, char const* category) = 0; , char const* category) = 0;
protected: protected:
~buffer_allocator_interface() {} ~buffer_allocator_interface() {}

View File

@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#ifndef TORRENT_DISABLE_POOL_ALLOCATOR #ifndef TORRENT_DISABLE_POOL_ALLOCATOR
@ -52,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
#include <mutex> #include <mutex>
#include <functional> #include <functional>
#include <memory>
#include "libtorrent/io_service_fwd.hpp" #include "libtorrent/io_service_fwd.hpp"
#include "libtorrent/file.hpp" // for iovec_t #include "libtorrent/file.hpp" // for iovec_t
@ -75,7 +75,7 @@ namespace libtorrent
#endif #endif
char* allocate_buffer(char const* category); char* allocate_buffer(char const* category);
char* allocate_buffer(bool& exceeded, boost::shared_ptr<disk_observer> o char* allocate_buffer(bool& exceeded, std::shared_ptr<disk_observer> o
, char const* category); , char const* category);
void free_buffer(char* buf); void free_buffer(char* buf);
void free_multiple_buffers(char** bufvec, int numbufs); void free_multiple_buffers(char** bufvec, int numbufs);
@ -121,7 +121,7 @@ namespace libtorrent
// adding up callbacks to this queue. Once the number // adding up callbacks to this queue. Once the number
// of buffers in use drops below the low watermark, // of buffers in use drops below the low watermark,
// we start calling these functions back // we start calling these functions back
std::vector<boost::weak_ptr<disk_observer>> m_observers; std::vector<std::weak_ptr<disk_observer>> m_observers;
// callback used to tell the cache it needs to free up some blocks // callback used to tell the cache it needs to free up some blocks
std::function<void()> m_trigger_cache_trim; std::function<void()> m_trigger_cache_trim;

View File

@ -53,7 +53,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/shared_array.hpp> #include <boost/shared_array.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
@ -64,6 +63,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <memory>
namespace libtorrent namespace libtorrent
{ {
class alert; class alert;
@ -357,11 +358,11 @@ namespace libtorrent
disk_buffer_holder allocate_disk_buffer(char const* category) override disk_buffer_holder allocate_disk_buffer(char const* category) override
{ {
bool exceed = false; bool exceed = false;
return allocate_disk_buffer(exceed, boost::shared_ptr<disk_observer>(), category); return allocate_disk_buffer(exceed, std::shared_ptr<disk_observer>(), category);
} }
void trigger_cache_trim(); void trigger_cache_trim();
disk_buffer_holder allocate_disk_buffer(bool& exceeded, boost::shared_ptr<disk_observer> o disk_buffer_holder allocate_disk_buffer(bool& exceeded, std::shared_ptr<disk_observer> o
, char const* category) override; , char const* category) override;
bool exceeded_cache_use() const bool exceeded_cache_use() const

View File

@ -43,7 +43,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/smart_ptr.hpp>
#ifdef TORRENT_WINDOWS #ifdef TORRENT_WINDOWS
// windows part // windows part
@ -224,12 +223,12 @@ namespace libtorrent
char stack[2048]; char stack[2048];
private: private:
boost::shared_ptr<file> m_file; std::shared_ptr<file> m_file;
}; };
void TORRENT_EXTRA_EXPORT print_open_files(char const* event, char const* name); void TORRENT_EXTRA_EXPORT print_open_files(char const* event, char const* name);
#else #else
using file_handle = boost::shared_ptr<file>; using file_handle = std::shared_ptr<file>;
#endif #endif
struct TORRENT_EXTRA_EXPORT file: boost::noncopyable struct TORRENT_EXTRA_EXPORT file: boost::noncopyable
@ -358,4 +357,3 @@ namespace libtorrent
} }
#endif // TORRENT_FILE_HPP_INCLUDED #endif // TORRENT_FILE_HPP_INCLUDED

View File

@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL

View File

@ -35,12 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/lazy_entry.hpp" #include "libtorrent/lazy_entry.hpp"

View File

@ -75,8 +75,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/smart_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@ -273,7 +271,7 @@ namespace libtorrent
, public peer_class_set , public peer_class_set
, public disk_observer , public disk_observer
, public peer_connection_interface , public peer_connection_interface
, public boost::enable_shared_from_this<peer_connection> , public std::enable_shared_from_this<peer_connection>
{ {
friend class invariant_access; friend class invariant_access;
friend class torrent; friend class torrent;
@ -705,7 +703,7 @@ namespace libtorrent
enum sync_t { read_async, read_sync }; enum sync_t { read_async, read_sync };
void setup_receive(); void setup_receive();
boost::shared_ptr<peer_connection> self() std::shared_ptr<peer_connection> self()
{ {
TORRENT_ASSERT(!m_in_constructor); TORRENT_ASSERT(!m_in_constructor);
return shared_from_this(); return shared_from_this();

View File

@ -53,7 +53,7 @@ typedef boost::system::error_code error_code;
// hidden // hidden
struct TORRENT_EXPORT peer_connection_handle struct TORRENT_EXPORT peer_connection_handle
{ {
peer_connection_handle(boost::weak_ptr<peer_connection> impl) peer_connection_handle(std::weak_ptr<peer_connection> impl)
: m_connection(impl) : m_connection(impl)
{} {}
@ -113,19 +113,26 @@ struct TORRENT_EXPORT peer_connection_handle
time_point time_of_last_unchoke() const; time_point time_of_last_unchoke() const;
bool operator==(peer_connection_handle const& o) const bool operator==(peer_connection_handle const& o) const
{ return !(m_connection < o.m_connection) && !(o.m_connection < m_connection); } { return !lt(m_connection, o.m_connection) && !lt(o.m_connection, m_connection); }
bool operator!=(peer_connection_handle const& o) const bool operator!=(peer_connection_handle const& o) const
{ return m_connection < o.m_connection || o.m_connection < m_connection; } { return lt(m_connection, o.m_connection) || lt(o.m_connection, m_connection); }
bool operator<(peer_connection_handle const& o) const bool operator<(peer_connection_handle const& o) const
{ return m_connection < o.m_connection; } { return lt(m_connection, o.m_connection); }
boost::shared_ptr<peer_connection> native_handle() const std::shared_ptr<peer_connection> native_handle() const
{ {
return m_connection.lock(); return m_connection.lock();
} }
private: private:
boost::weak_ptr<peer_connection> m_connection; std::weak_ptr<peer_connection> m_connection;
// copied from boost::weak_ptr
bool lt(std::weak_ptr<peer_connection> const& a
, std::weak_ptr<peer_connection> const& b) const
{
return a.owner_before(b);
}
}; };
struct TORRENT_EXPORT bt_peer_connection_handle : public peer_connection_handle struct TORRENT_EXPORT bt_peer_connection_handle : public peer_connection_handle
@ -142,7 +149,7 @@ struct TORRENT_EXPORT bt_peer_connection_handle : public peer_connection_handle
void switch_send_crypto(std::shared_ptr<crypto_plugin> crypto); void switch_send_crypto(std::shared_ptr<crypto_plugin> crypto);
void switch_recv_crypto(std::shared_ptr<crypto_plugin> crypto); void switch_recv_crypto(std::shared_ptr<crypto_plugin> crypto);
boost::shared_ptr<bt_peer_connection> native_handle() const; std::shared_ptr<bt_peer_connection> native_handle() const;
}; };
} // namespace libtorrent } // namespace libtorrent

View File

@ -114,13 +114,13 @@ namespace libtorrent
session_proxy& operator=(session_proxy const&); session_proxy& operator=(session_proxy const&);
private: private:
session_proxy( session_proxy(
boost::shared_ptr<io_service> ios std::shared_ptr<io_service> ios
, std::shared_ptr<std::thread> t , std::shared_ptr<std::thread> t
, boost::shared_ptr<aux::session_impl> impl); , std::shared_ptr<aux::session_impl> impl);
boost::shared_ptr<io_service> m_io_service; std::shared_ptr<io_service> m_io_service;
std::shared_ptr<std::thread> m_thread; std::shared_ptr<std::thread> m_thread;
boost::shared_ptr<aux::session_impl> m_impl; std::shared_ptr<aux::session_impl> m_impl;
}; };
// The session_params is a parameters pack for configuring the session // The session_params is a parameters pack for configuring the session
@ -337,9 +337,9 @@ namespace libtorrent
// data shared between the main thread // data shared between the main thread
// and the working thread // and the working thread
boost::shared_ptr<io_service> m_io_service; std::shared_ptr<io_service> m_io_service;
std::shared_ptr<std::thread> m_thread; std::shared_ptr<std::thread> m_thread;
boost::shared_ptr<aux::session_impl> m_impl; std::shared_ptr<aux::session_impl> m_impl;
}; };
} }

View File

@ -37,10 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/string_view.hpp" #include "libtorrent/string_view.hpp"
#include <vector> #include <vector>
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/smart_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
// OVERVIEW // OVERVIEW
// //
@ -59,7 +56,7 @@ namespace libtorrent
struct settings_pack; struct settings_pack;
struct bdecode_node; struct bdecode_node;
TORRENT_EXTRA_EXPORT boost::shared_ptr<settings_pack> load_pack_from_dict(bdecode_node const& settings); TORRENT_EXTRA_EXPORT std::shared_ptr<settings_pack> load_pack_from_dict(bdecode_node const& settings);
TORRENT_EXTRA_EXPORT void save_settings_to_dict(aux::session_settings const& s, entry::dictionary_type& sett); TORRENT_EXTRA_EXPORT void save_settings_to_dict(aux::session_settings const& s, entry::dictionary_type& sett);
TORRENT_EXTRA_EXPORT void apply_pack(settings_pack const* pack, aux::session_settings& sett TORRENT_EXTRA_EXPORT void apply_pack(settings_pack const* pack, aux::session_settings& sett
, aux::session_impl* ses = nullptr); , aux::session_impl* ses = nullptr);
@ -69,7 +66,7 @@ namespace libtorrent
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
struct session_settings; struct session_settings;
boost::shared_ptr<settings_pack> load_pack_from_struct(aux::session_settings const& current, session_settings const& s); std::shared_ptr<settings_pack> load_pack_from_struct(aux::session_settings const& current, session_settings const& s);
void load_struct_from_settings(aux::session_settings const& current, session_settings& ret); void load_struct_from_settings(aux::session_settings const& current, session_settings& ret);
#endif #endif

View File

@ -39,12 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <mutex> #include <mutex>
#include <atomic> #include <atomic>
#include <unordered_set> #include <unordered_set>
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <sys/types.h> #include <sys/types.h>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/piece_picker.hpp" #include "libtorrent/piece_picker.hpp"

View File

@ -41,13 +41,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <limits> // for numeric_limits #include <limits> // for numeric_limits
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/torrent_handle.hpp" #include "libtorrent/torrent_handle.hpp"
#include "libtorrent/entry.hpp" #include "libtorrent/entry.hpp"
#include "libtorrent/torrent_info.hpp" #include "libtorrent/torrent_info.hpp"
@ -382,7 +375,7 @@ namespace libtorrent
}; };
void read_piece(int piece); void read_piece(int piece);
void on_disk_read_complete(disk_io_job const* j, peer_request r void on_disk_read_complete(disk_io_job const* j, peer_request r
, boost::shared_ptr<read_piece_struct> rp); , std::shared_ptr<read_piece_struct> rp);
storage_mode_t storage_mode() const; storage_mode_t storage_mode() const;
storage_interface* get_storage(); storage_interface* get_storage();
@ -434,7 +427,7 @@ namespace libtorrent
void sent_syn(bool ipv6); void sent_syn(bool ipv6);
void received_synack(bool ipv6); void received_synack(bool ipv6);
void set_ip_filter(boost::shared_ptr<const ip_filter> ipf); void set_ip_filter(std::shared_ptr<const ip_filter> ipf);
void port_filter_updated(); void port_filter_updated();
ip_filter const* get_ip_filter() { return m_ip_filter.get(); } ip_filter const* get_ip_filter() { return m_ip_filter.get(); }
@ -1143,7 +1136,7 @@ namespace libtorrent
void need_peer_list(); void need_peer_list();
boost::shared_ptr<const ip_filter> m_ip_filter; std::shared_ptr<const ip_filter> m_ip_filter;
// all time totals of uploaded and downloaded payload // all time totals of uploaded and downloaded payload
// stored in resume data // stored in resume data
@ -1170,7 +1163,7 @@ namespace libtorrent
std::shared_ptr<piece_manager> m_storage; std::shared_ptr<piece_manager> m_storage;
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
boost::shared_ptr<boost::asio::ssl::context> m_ssl_ctx; std::shared_ptr<boost::asio::ssl::context> m_ssl_ctx;
bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx); bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx);

View File

@ -38,11 +38,9 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
#include <set> #include <set>
#include <functional> #include <functional>
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// for deprecated force_reannounce // for deprecated force_reannounce
#include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/date_time/posix_time/posix_time_duration.hpp>

View File

@ -42,12 +42,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstdint> #include <cstdint>
#include <tuple> #include <tuple>
#include <functional> #include <functional>
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
@ -136,7 +134,7 @@ namespace libtorrent
std::string auth; std::string auth;
#endif #endif
boost::shared_ptr<const ip_filter> filter; std::shared_ptr<const ip_filter> filter;
std::int64_t downloaded; std::int64_t downloaded;
std::int64_t uploaded; std::int64_t uploaded;
@ -299,7 +297,7 @@ namespace libtorrent
, io_service& ios , io_service& ios
, std::weak_ptr<request_callback> r); , std::weak_ptr<request_callback> r);
void update_transaction_id(boost::shared_ptr<udp_tracker_connection> c void update_transaction_id(std::shared_ptr<udp_tracker_connection> c
, std::uint64_t tid); , std::uint64_t tid);
std::shared_ptr<request_callback> requester() const; std::shared_ptr<request_callback> requester() const;

View File

@ -39,10 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <ctime> #include <ctime>
#include <mutex> #include <mutex>
#include <cstdint> #include <cstdint>
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/udp_socket.hpp" #include "libtorrent/udp_socket.hpp"
#include "libtorrent/entry.hpp" #include "libtorrent/entry.hpp"

View File

@ -42,10 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/resolver.hpp" #include "libtorrent/resolver.hpp"
#include "libtorrent/debug.hpp" #include "libtorrent/debug.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp" #include <memory>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <functional> #include <functional>
#include <set> #include <set>

View File

@ -254,7 +254,7 @@ struct dht_node final : lt::dht::udp_socket_interface
private: private:
asio::io_service m_io_service; asio::io_service m_io_service;
boost::shared_ptr<dht::dht_storage_interface> m_dht_storage; std::shared_ptr<dht::dht_storage_interface> m_dht_storage;
#if LIBSIMULATOR_USE_MOVE #if LIBSIMULATOR_USE_MOVE
lt::udp::socket m_socket; lt::udp::socket m_socket;
lt::udp::socket& sock() { return m_socket; } lt::udp::socket& sock() { return m_socket; }

View File

@ -260,8 +260,8 @@ void setup_swarm(int num_nodes
asio::io_service ios(sim); asio::io_service ios(sim);
lt::time_point start_time(lt::clock_type::now()); lt::time_point start_time(lt::clock_type::now());
std::vector<boost::shared_ptr<lt::session> > nodes; std::vector<std::shared_ptr<lt::session>> nodes;
std::vector<boost::shared_ptr<sim::asio::io_service> > io_service; std::vector<std::shared_ptr<sim::asio::io_service>> io_service;
std::vector<lt::session_proxy> zombies; std::vector<lt::session_proxy> zombies;
lt::deadline_timer timer(ios); lt::deadline_timer timer(ios);
@ -286,8 +286,7 @@ void setup_swarm(int num_nodes
ips.push_back(addr(ep)); ips.push_back(addr(ep));
std::snprintf(ep, sizeof(ep), "2000::%X%X", (i + 1) >> 8, (i + 1) & 0xff); std::snprintf(ep, sizeof(ep), "2000::%X%X", (i + 1) >> 8, (i + 1) & 0xff);
ips.push_back(addr(ep)); ips.push_back(addr(ep));
io_service.push_back(boost::make_shared<sim::asio::io_service>( io_service.push_back(std::make_shared<sim::asio::io_service>(sim, ips));
std::ref(sim), ips));
lt::settings_pack pack = default_settings; lt::settings_pack pack = default_settings;
@ -297,9 +296,8 @@ void setup_swarm(int num_nodes
pack.set_str(lt::settings_pack::peer_fingerprint, pid.to_string()); pack.set_str(lt::settings_pack::peer_fingerprint, pid.to_string());
if (i == 0) new_session(pack); if (i == 0) new_session(pack);
boost::shared_ptr<lt::session> ses = std::shared_ptr<lt::session> ses =
boost::make_shared<lt::session>(pack std::make_shared<lt::session>(pack, *io_service.back());
, std::ref(*io_service.back()));
init_session(*ses); init_session(*ses);
nodes.push_back(ses); nodes.push_back(ses);
@ -396,7 +394,7 @@ void setup_swarm(int num_nodes
if (type == swarm_test::upload) if (type == swarm_test::upload)
{ {
shut_down |= std::all_of(nodes.begin() + 1, nodes.end() shut_down |= std::all_of(nodes.begin() + 1, nodes.end()
, [](boost::shared_ptr<lt::session> const& s) , [](std::shared_ptr<lt::session> const& s)
{ return is_seed(*s); }); { return is_seed(*s); });
if (tick > 88 * (num_nodes - 1) && !shut_down) if (tick > 88 * (num_nodes - 1) && !shut_down)

View File

@ -78,7 +78,7 @@ TORRENT_TEST(dht_bootstrap)
pack.set_bool(lt::settings_pack::enable_natpmp, false); pack.set_bool(lt::settings_pack::enable_natpmp, false);
pack.set_bool(lt::settings_pack::enable_dht, true); pack.set_bool(lt::settings_pack::enable_dht, true);
sim::asio::io_service ios(sim, addr("10.0.0.1")); sim::asio::io_service ios(sim, addr("10.0.0.1"));
boost::shared_ptr<lt::session> ses = boost::make_shared<lt::session>(pack, ios); std::shared_ptr<lt::session> ses = std::make_shared<lt::session>(pack, ios);
lt::deadline_timer timer(ios); lt::deadline_timer timer(ios);
timer.expires_from_now(lt::seconds(10)); timer.expires_from_now(lt::seconds(10));

View File

@ -110,8 +110,8 @@ TORRENT_TEST(dht_rate_limit)
counters cnt; counters cnt;
entry state; entry state;
std::unique_ptr<lt::dht::dht_storage_interface> dht_storage(dht::dht_default_storage_constructor(dhtsett)); std::unique_ptr<lt::dht::dht_storage_interface> dht_storage(dht::dht_default_storage_constructor(dhtsett));
boost::shared_ptr<lt::dht::dht_tracker> dht = boost::make_shared<lt::dht::dht_tracker>( std::shared_ptr<lt::dht::dht_tracker> dht = std::make_shared<lt::dht::dht_tracker>(
&o, std::ref(dht_ios), std::bind(&udp_socket::send, &sock, _1, _2, _3, _4) &o, dht_ios, std::bind(&udp_socket::send, &sock, _1, _2, _3, _4)
, dhtsett, cnt, *dht_storage, state); , dhtsett, cnt, *dht_storage, state);
bool stop = false; bool stop = false;

View File

@ -47,10 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_info.hpp" #include "libtorrent/torrent_info.hpp"
#include "libtorrent/deadline_timer.hpp" #include "libtorrent/deadline_timer.hpp"
#include <boost/bind.hpp> #include <memory>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/ref.hpp>
struct choke_state struct choke_state
{ {

View File

@ -41,7 +41,7 @@ using namespace libtorrent;
TORRENT_TEST(seed_and_suggest_mode) TORRENT_TEST(seed_and_suggest_mode)
{ {
boost::shared_ptr<entry> resume_data; std::shared_ptr<entry> resume_data;
// with seed mode // with seed mode
setup_swarm(2, swarm_test::upload setup_swarm(2, swarm_test::upload

View File

@ -739,7 +739,7 @@ namespace libtorrent {
} }
save_resume_data_alert::save_resume_data_alert(aux::stack_allocator& alloc save_resume_data_alert::save_resume_data_alert(aux::stack_allocator& alloc
, boost::shared_ptr<entry> const& rd , std::shared_ptr<entry> const& rd
, torrent_handle const& h) , torrent_handle const& h)
: torrent_alert(alloc, h) : torrent_alert(alloc, h)
, resume_data(rd) , resume_data(rd)

View File

@ -84,7 +84,7 @@ namespace libtorrent
// non prioritized means that, if there's a line for bandwidth, // non prioritized means that, if there's a line for bandwidth,
// others will cut in front of the non-prioritized peers. // others will cut in front of the non-prioritized peers.
// this is used by web seeds // this is used by web seeds
int bandwidth_manager::request_bandwidth(boost::shared_ptr<bandwidth_socket> const& peer int bandwidth_manager::request_bandwidth(std::shared_ptr<bandwidth_socket> const& peer
, int blk, int priority, bandwidth_channel** chan, int num_channels) , int blk, int priority, bandwidth_channel** chan, int num_channels)
{ {
INVARIANT_CHECK; INVARIANT_CHECK;

View File

@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
bw_request::bw_request(boost::shared_ptr<bandwidth_socket> const& pe bw_request::bw_request(std::shared_ptr<bandwidth_socket> const& pe
, int blk, int prio) , int blk, int prio)
: peer(pe) : peer(pe)
, priority(prio) , priority(prio)

View File

@ -213,7 +213,7 @@ namespace libtorrent
{ {
using namespace boost::asio::ip::multicast; using namespace boost::asio::ip::multicast;
boost::shared_ptr<udp::socket> s(new udp::socket(ios)); std::shared_ptr<udp::socket> s = std::make_shared<udp::socket>(ios);
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec); s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
if (ec) return; if (ec) return;
s->set_option(udp::socket::reuse_address(true), ec); s->set_option(udp::socket::reuse_address(true), ec);
@ -238,7 +238,7 @@ namespace libtorrent
, address_v4 const& mask) , address_v4 const& mask)
{ {
error_code ec; error_code ec;
boost::shared_ptr<udp::socket> s(new udp::socket(ios)); std::shared_ptr<udp::socket> s = std::make_shared<udp::socket>(ios);
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec); s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
if (ec) return; if (ec) return;
s->bind(udp::endpoint(addr, 0), ec); s->bind(udp::endpoint(addr, 0), ec);

View File

@ -73,8 +73,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/hasher.hpp" #include "libtorrent/hasher.hpp"
#endif #endif
using boost::shared_ptr;
namespace libtorrent namespace libtorrent
{ {
namespace mp = boost::multiprecision; namespace mp = boost::multiprecision;

View File

@ -42,13 +42,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp" // for counters #include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/alert_manager.hpp" #include "libtorrent/alert_manager.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <functional> #include <functional>
#include <memory>
using namespace std::placeholders; using namespace std::placeholders;

View File

@ -60,11 +60,11 @@ namespace libtorrent
namespace { namespace {
// this is posted to the network thread // this is posted to the network thread
void watermark_callback(std::vector<boost::weak_ptr<disk_observer>> const& cbs) void watermark_callback(std::vector<std::weak_ptr<disk_observer>> const& cbs)
{ {
for (auto const& i : cbs) for (auto const& i : cbs)
{ {
boost::shared_ptr<disk_observer> o = i.lock(); std::shared_ptr<disk_observer> o = i.lock();
if (o) o->on_disk(); if (o) o->on_disk();
} }
} }
@ -148,7 +148,7 @@ namespace libtorrent
m_exceeded_max_size = false; m_exceeded_max_size = false;
std::vector<boost::weak_ptr<disk_observer>> cbs; std::vector<std::weak_ptr<disk_observer>> cbs;
m_observers.swap(cbs); m_observers.swap(cbs);
l.unlock(); l.unlock();
m_ios.post(std::bind(&watermark_callback, std::move(cbs))); m_ios.post(std::bind(&watermark_callback, std::move(cbs)));
@ -205,7 +205,7 @@ namespace libtorrent
// that there's more room in the pool now. This caps the amount of over- // that there's more room in the pool now. This caps the amount of over-
// allocation to one block per peer connection. // allocation to one block per peer connection.
char* disk_buffer_pool::allocate_buffer(bool& exceeded char* disk_buffer_pool::allocate_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o, char const* category) , std::shared_ptr<disk_observer> o, char const* category)
{ {
std::unique_lock<std::mutex> l(m_pool_mutex); std::unique_lock<std::mutex> l(m_pool_mutex);
char* ret = allocate_buffer_impl(l, category); char* ret = allocate_buffer_impl(l, category);

View File

@ -3353,7 +3353,7 @@ namespace libtorrent
} }
disk_buffer_holder disk_io_thread::allocate_disk_buffer(bool& exceeded disk_buffer_holder disk_io_thread::allocate_disk_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o , std::shared_ptr<disk_observer> o
, char const* category) , char const* category)
{ {
char* ret = m_disk_cache.allocate_buffer(exceeded, o, category); char* ret = m_disk_cache.allocate_buffer(exceeded, o, category);

View File

@ -171,7 +171,7 @@ namespace libtorrent
// file, we can only delete our reference to it. // file, we can only delete our reference to it.
// if this is the only reference to the file, it will be closed // if this is the only reference to the file, it will be closed
defer_destruction = e.file_ptr; defer_destruction = e.file_ptr;
e.file_ptr = boost::make_shared<file>(); e.file_ptr = std::make_shared<file>();
std::string full_path = fs.file_path(file_index, p); std::string full_path = fs.file_path(file_index, p);
if (!e.file_ptr->open(full_path, m, ec)) if (!e.file_ptr->open(full_path, m, ec))
@ -191,7 +191,7 @@ namespace libtorrent
} }
lru_file_entry e; lru_file_entry e;
e.file_ptr = boost::make_shared<file>(); e.file_ptr = std::make_shared<file>();
if (!e.file_ptr) if (!e.file_ptr)
{ {
ec = error_code(boost::system::errc::not_enough_memory, generic_category()); ec = error_code(boost::system::errc::not_enough_memory, generic_category());

View File

@ -39,8 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_info.hpp" #include "libtorrent/peer_info.hpp"
#include "libtorrent/hex.hpp" // for is_hex #include "libtorrent/hex.hpp" // for is_hex
using boost::shared_ptr;
namespace libtorrent namespace libtorrent
{ {
http_seed_connection::http_seed_connection(peer_connection_args const& pack http_seed_connection::http_seed_connection(peer_connection_args const& pack

View File

@ -80,7 +80,6 @@ POSSIBILITY OF SUCH DAMAGE.
//#define TORRENT_CORRUPT_DATA //#define TORRENT_CORRUPT_DATA
using boost::shared_ptr;
using namespace std::placeholders; using namespace std::placeholders;
namespace libtorrent namespace libtorrent
@ -1376,7 +1375,7 @@ namespace libtorrent
std::vector<pending_block>::iterator dlq_iter = std::find_if( std::vector<pending_block>::iterator dlq_iter = std::find_if(
m_download_queue.begin(), m_download_queue.end() m_download_queue.begin(), m_download_queue.end()
, std::bind(match_request, boost::cref(r), std::bind(&pending_block::block, _1) , std::bind(match_request, std::cref(r), std::bind(&pending_block::block, _1)
, t->block_size())); , t->block_size()));
if (dlq_iter != m_download_queue.end()) if (dlq_iter != m_download_queue.end())
@ -4111,7 +4110,7 @@ namespace libtorrent
#endif // TORRENT_DISABLE_ENCRYPTION #endif // TORRENT_DISABLE_ENCRYPTION
} }
boost::shared_ptr<peer_connection> me(self()); std::shared_ptr<peer_connection> me(self());
INVARIANT_CHECK; INVARIANT_CHECK;
@ -4530,7 +4529,7 @@ namespace libtorrent
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
time_point now = aux::time_now(); time_point now = aux::time_now();
boost::shared_ptr<peer_connection> me(self()); std::shared_ptr<peer_connection> me(self());
// the invariant check must be run before me is destructed // the invariant check must be run before me is destructed
// in case the peer got disconnected // in case the peer got disconnected
@ -5515,7 +5514,7 @@ namespace libtorrent
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
if ((m_channel_state[download_channel] & peer_info::bw_disk) == 0) return; if ((m_channel_state[download_channel] & peer_info::bw_disk) == 0) return;
boost::shared_ptr<peer_connection> me(self()); std::shared_ptr<peer_connection> me(self());
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "DISK", "dropped below disk buffer watermark"); peer_log(peer_log_alert::info, "DISK", "dropped below disk buffer watermark");
@ -5739,7 +5738,7 @@ namespace libtorrent
// case we disconnect // case we disconnect
// this needs to be created before the invariant check, // this needs to be created before the invariant check,
// to keep the object alive through the exit check // to keep the object alive through the exit check
boost::shared_ptr<peer_connection> me(self()); std::shared_ptr<peer_connection> me(self());
// flush the send buffer at the end of this function // flush the send buffer at the end of this function
cork _c(*this); cork _c(*this);
@ -6074,7 +6073,7 @@ namespace libtorrent
COMPLETE_ASYNC("peer_connection::on_send_data"); COMPLETE_ASYNC("peer_connection::on_send_data");
// keep ourselves alive in until this function exits in // keep ourselves alive in until this function exits in
// case we disconnect // case we disconnect
boost::shared_ptr<peer_connection> me(self()); std::shared_ptr<peer_connection> me(self());
TORRENT_ASSERT(m_channel_state[upload_channel] & peer_info::bw_network); TORRENT_ASSERT(m_channel_state[upload_channel] & peer_info::bw_network);

View File

@ -43,7 +43,7 @@ namespace libtorrent
int peer_connection_handle::type() const int peer_connection_handle::type() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->type(); return pc->type();
} }
@ -51,7 +51,7 @@ int peer_connection_handle::type() const
void peer_connection_handle::add_extension(std::shared_ptr<peer_plugin> ext) void peer_connection_handle::add_extension(std::shared_ptr<peer_plugin> ext)
{ {
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->add_extension(ext); pc->add_extension(ext);
#else #else
@ -61,84 +61,84 @@ void peer_connection_handle::add_extension(std::shared_ptr<peer_plugin> ext)
bool peer_connection_handle::is_seed() const bool peer_connection_handle::is_seed() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_seed(); return pc->is_seed();
} }
bool peer_connection_handle::upload_only() const bool peer_connection_handle::upload_only() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->upload_only(); return pc->upload_only();
} }
peer_id const& peer_connection_handle::pid() const peer_id const& peer_connection_handle::pid() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->pid(); return pc->pid();
} }
bool peer_connection_handle::has_piece(int i) const bool peer_connection_handle::has_piece(int i) const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->has_piece(i); return pc->has_piece(i);
} }
bool peer_connection_handle::is_interesting() const bool peer_connection_handle::is_interesting() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_interesting(); return pc->is_interesting();
} }
bool peer_connection_handle::is_choked() const bool peer_connection_handle::is_choked() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_choked(); return pc->is_choked();
} }
bool peer_connection_handle::is_peer_interested() const bool peer_connection_handle::is_peer_interested() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_peer_interested(); return pc->is_peer_interested();
} }
bool peer_connection_handle::has_peer_choked() const bool peer_connection_handle::has_peer_choked() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->has_peer_choked(); return pc->has_peer_choked();
} }
void peer_connection_handle::choke_this_peer() void peer_connection_handle::choke_this_peer()
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->choke_this_peer(); pc->choke_this_peer();
} }
void peer_connection_handle::maybe_unchoke_this_peer() void peer_connection_handle::maybe_unchoke_this_peer()
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->maybe_unchoke_this_peer(); pc->maybe_unchoke_this_peer();
} }
void peer_connection_handle::get_peer_info(peer_info& p) const void peer_connection_handle::get_peer_info(peer_info& p) const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->get_peer_info(p); pc->get_peer_info(p);
} }
torrent_handle peer_connection_handle::associated_torrent() const torrent_handle peer_connection_handle::associated_torrent() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
if (!pc) return torrent_handle(); if (!pc) return torrent_handle();
std::shared_ptr<torrent> t = pc->associated_torrent().lock(); std::shared_ptr<torrent> t = pc->associated_torrent().lock();
if (!t) return torrent_handle(); if (!t) return torrent_handle();
@ -147,63 +147,63 @@ torrent_handle peer_connection_handle::associated_torrent() const
tcp::endpoint const& peer_connection_handle::remote() const tcp::endpoint const& peer_connection_handle::remote() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->remote(); return pc->remote();
} }
tcp::endpoint peer_connection_handle::local_endpoint() const tcp::endpoint peer_connection_handle::local_endpoint() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->local_endpoint(); return pc->local_endpoint();
} }
void peer_connection_handle::disconnect(error_code const& ec, operation_t op, int error) void peer_connection_handle::disconnect(error_code const& ec, operation_t op, int error)
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->disconnect(ec, op, error); pc->disconnect(ec, op, error);
} }
bool peer_connection_handle::is_disconnecting() const bool peer_connection_handle::is_disconnecting() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_disconnecting(); return pc->is_disconnecting();
} }
bool peer_connection_handle::is_connecting() const bool peer_connection_handle::is_connecting() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_connecting(); return pc->is_connecting();
} }
bool peer_connection_handle::is_outgoing() const bool peer_connection_handle::is_outgoing() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->is_outgoing(); return pc->is_outgoing();
} }
bool peer_connection_handle::on_local_network() const bool peer_connection_handle::on_local_network() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->on_local_network(); return pc->on_local_network();
} }
bool peer_connection_handle::ignore_unchoke_slots() const bool peer_connection_handle::ignore_unchoke_slots() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->ignore_unchoke_slots(); return pc->ignore_unchoke_slots();
} }
bool peer_connection_handle::failed() const bool peer_connection_handle::failed() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->failed(); return pc->failed();
} }
@ -214,7 +214,7 @@ TORRENT_FORMAT(4,5)
void peer_connection_handle::peer_log(peer_log_alert::direction_t direction void peer_connection_handle::peer_log(peer_log_alert::direction_t direction
, char const* event, char const* fmt, ...) const , char const* event, char const* fmt, ...) const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
va_list v; va_list v;
va_start(v, fmt); va_start(v, fmt);
@ -234,56 +234,56 @@ void peer_connection_handle::peer_log(peer_log_alert::direction_t direction
bool peer_connection_handle::can_disconnect(error_code const& ec) const bool peer_connection_handle::can_disconnect(error_code const& ec) const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->can_disconnect(ec); return pc->can_disconnect(ec);
} }
bool peer_connection_handle::has_metadata() const bool peer_connection_handle::has_metadata() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->has_metadata(); return pc->has_metadata();
} }
bool peer_connection_handle::in_handshake() const bool peer_connection_handle::in_handshake() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->in_handshake(); return pc->in_handshake();
} }
void peer_connection_handle::send_buffer(char const* begin, int size, int flags) void peer_connection_handle::send_buffer(char const* begin, int size, int flags)
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->send_buffer(begin, size, flags); pc->send_buffer(begin, size, flags);
} }
time_t peer_connection_handle::last_seen_complete() const time_t peer_connection_handle::last_seen_complete() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->last_seen_complete(); return pc->last_seen_complete();
} }
time_point peer_connection_handle::time_of_last_unchoke() const time_point peer_connection_handle::time_of_last_unchoke() const
{ {
boost::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->time_of_last_unchoke(); return pc->time_of_last_unchoke();
} }
bool bt_peer_connection_handle::packet_finished() const bool bt_peer_connection_handle::packet_finished() const
{ {
boost::shared_ptr<bt_peer_connection> pc = native_handle(); std::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->packet_finished(); return pc->packet_finished();
} }
bool bt_peer_connection_handle::support_extensions() const bool bt_peer_connection_handle::support_extensions() const
{ {
boost::shared_ptr<bt_peer_connection> pc = native_handle(); std::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->support_extensions(); return pc->support_extensions();
} }
@ -291,7 +291,7 @@ bool bt_peer_connection_handle::support_extensions() const
bool bt_peer_connection_handle::supports_encryption() const bool bt_peer_connection_handle::supports_encryption() const
{ {
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
boost::shared_ptr<bt_peer_connection> pc = native_handle(); std::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
return pc->supports_encryption(); return pc->supports_encryption();
#else #else
@ -302,7 +302,7 @@ bool bt_peer_connection_handle::supports_encryption() const
void bt_peer_connection_handle::switch_send_crypto(std::shared_ptr<crypto_plugin> crypto) void bt_peer_connection_handle::switch_send_crypto(std::shared_ptr<crypto_plugin> crypto)
{ {
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
boost::shared_ptr<bt_peer_connection> pc = native_handle(); std::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->switch_send_crypto(crypto); pc->switch_send_crypto(crypto);
#else #else
@ -313,7 +313,7 @@ void bt_peer_connection_handle::switch_send_crypto(std::shared_ptr<crypto_plugin
void bt_peer_connection_handle::switch_recv_crypto(std::shared_ptr<crypto_plugin> crypto) void bt_peer_connection_handle::switch_recv_crypto(std::shared_ptr<crypto_plugin> crypto)
{ {
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
boost::shared_ptr<bt_peer_connection> pc = native_handle(); std::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->switch_recv_crypto(crypto); pc->switch_recv_crypto(crypto);
#else #else
@ -321,9 +321,9 @@ void bt_peer_connection_handle::switch_recv_crypto(std::shared_ptr<crypto_plugin
#endif #endif
} }
boost::shared_ptr<bt_peer_connection> bt_peer_connection_handle::native_handle() const std::shared_ptr<bt_peer_connection> bt_peer_connection_handle::native_handle() const
{ {
return boost::static_pointer_cast<bt_peer_connection>( return std::static_pointer_cast<bt_peer_connection>(
peer_connection_handle::native_handle()); peer_connection_handle::native_handle());
} }

View File

@ -30,12 +30,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/utility.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <functional> #include <functional>
#include "libtorrent/peer_connection.hpp" #include "libtorrent/peer_connection.hpp"
@ -53,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/extensions.hpp" #include "libtorrent/extensions.hpp"
#include "libtorrent/ip_filter.hpp" #include "libtorrent/ip_filter.hpp"
#include "libtorrent/torrent_peer_allocator.hpp" #include "libtorrent/torrent_peer_allocator.hpp"
#include "libtorrent/ip_voter.hpp" // for external_ip
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
#include "libtorrent/socket_io.hpp" // for print_endpoint #include "libtorrent/socket_io.hpp" // for print_endpoint
@ -60,7 +55,6 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp" // for print_endpoint #include "libtorrent/socket_io.hpp" // for print_endpoint
#include "libtorrent/ip_voter.hpp" // for external_ip
#endif #endif
using namespace std::placeholders; using namespace std::placeholders;
@ -550,7 +544,7 @@ namespace libtorrent
// insert this candidate sorted into peers // insert this candidate sorted into peers
std::vector<torrent_peer*>::iterator i = std::lower_bound(peers.begin(), peers.end() std::vector<torrent_peer*>::iterator i = std::lower_bound(peers.begin(), peers.end()
, &pe, std::bind(&peer_list::compare_peer, this, _1, _2, boost::cref(external), external_port)); , &pe, std::bind(&peer_list::compare_peer, this, _1, _2, std::cref(external), external_port));
peers.insert(i, &pe); peers.insert(i, &pe);
} }

View File

@ -296,11 +296,11 @@ namespace libtorrent
if (internal_executor) if (internal_executor)
{ {
// the user did not provide an executor, we have to use our own // the user did not provide an executor, we have to use our own
m_io_service = boost::make_shared<io_service>(); m_io_service = std::make_shared<io_service>();
ios = m_io_service.get(); ios = m_io_service.get();
} }
m_impl = boost::make_shared<session_impl>(std::ref(*ios)); m_impl = std::make_shared<session_impl>(*ios);
*static_cast<session_handle*>(this) = session_handle(m_impl.get()); *static_cast<session_handle*>(this) = session_handle(m_impl.get());
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
@ -354,7 +354,7 @@ namespace libtorrent
aux::dump_call_profile(); aux::dump_call_profile();
TORRENT_ASSERT(m_impl); TORRENT_ASSERT(m_impl);
boost::shared_ptr<session_impl> ptr = m_impl; std::shared_ptr<session_impl> ptr = m_impl;
// capture the shared_ptr in the dispatched function // capture the shared_ptr in the dispatched function
// to keep the session_impl alive // to keep the session_impl alive
@ -399,9 +399,9 @@ namespace libtorrent
#endif // TORRENT_NO_DEPRECATE #endif // TORRENT_NO_DEPRECATE
session_proxy::session_proxy() = default; session_proxy::session_proxy() = default;
session_proxy::session_proxy(boost::shared_ptr<io_service> ios session_proxy::session_proxy(std::shared_ptr<io_service> ios
, std::shared_ptr<std::thread> t , std::shared_ptr<std::thread> t
, boost::shared_ptr<aux::session_impl> impl) , std::shared_ptr<aux::session_impl> impl)
: m_io_service(std::move(ios)) : m_io_service(std::move(ios))
, m_thread(std::move(t)) , m_thread(std::move(t))
, m_impl(impl) , m_impl(impl)

View File

@ -680,7 +680,7 @@ namespace libtorrent
void session_handle::set_ip_filter(ip_filter const& f) void session_handle::set_ip_filter(ip_filter const& f)
{ {
boost::shared_ptr<ip_filter> copy = boost::make_shared<ip_filter>(f); std::shared_ptr<ip_filter> copy = std::make_shared<ip_filter>(f);
async_call(&session_impl::set_ip_filter, copy); async_call(&session_impl::set_ip_filter, copy);
} }
@ -844,7 +844,7 @@ namespace libtorrent
|| s.get_int(settings_pack::allowed_enc_level) || s.get_int(settings_pack::allowed_enc_level)
<= settings_pack::pe_both); <= settings_pack::pe_both);
boost::shared_ptr<settings_pack> copy = boost::make_shared<settings_pack>(std::move(s)); std::shared_ptr<settings_pack> copy = std::make_shared<settings_pack>(std::move(s));
async_call(&session_impl::apply_settings_pack, copy); async_call(&session_impl::apply_settings_pack, copy);
} }

View File

@ -47,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/function_equal.hpp> #include <boost/function_equal.hpp>
#include <boost/make_shared.hpp>
#include <boost/asio/ip/v6_only.hpp> #include <boost/asio/ip/v6_only.hpp>
#if TORRENT_USE_RLIMIT #if TORRENT_USE_RLIMIT
@ -169,8 +168,6 @@ namespace
#include <winerror.h> #include <winerror.h>
#endif #endif
using boost::shared_ptr;
using boost::weak_ptr;
using libtorrent::aux::session_impl; using libtorrent::aux::session_impl;
using namespace std::placeholders; using namespace std::placeholders;
@ -430,11 +427,11 @@ namespace aux {
session_log(" generated peer ID: %s", m_peer_id.to_string().c_str()); session_log(" generated peer ID: %s", m_peer_id.to_string().c_str());
#endif #endif
boost::shared_ptr<settings_pack> copy = boost::make_shared<settings_pack>(pack); std::shared_ptr<settings_pack> copy = std::make_shared<settings_pack>(pack);
m_io_service.post(std::bind(&session_impl::init, this, copy)); m_io_service.post(std::bind(&session_impl::init, this, copy));
} }
void session_impl::init(boost::shared_ptr<settings_pack> pack) void session_impl::init(std::shared_ptr<settings_pack> pack)
{ {
// this is a debug facility // this is a debug facility
// see single_threaded in debug.hpp // see single_threaded in debug.hpp
@ -695,7 +692,7 @@ namespace aux {
if (settings) if (settings)
{ {
// apply_settings_pack will update dht and proxy // apply_settings_pack will update dht and proxy
boost::shared_ptr<settings_pack> pack = load_pack_from_dict(settings); std::shared_ptr<settings_pack> pack = load_pack_from_dict(settings);
apply_settings_pack(pack); apply_settings_pack(pack);
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
need_update_dht = false; need_update_dht = false;
@ -918,7 +915,7 @@ namespace aux {
return m_connections.find(p->self()) != m_connections.end(); return m_connections.find(p->self()) != m_connections.end();
} }
void session_impl::insert_peer(boost::shared_ptr<peer_connection> const& c) void session_impl::insert_peer(std::shared_ptr<peer_connection> const& c)
{ {
TORRENT_ASSERT(!c->m_in_constructor); TORRENT_ASSERT(!c->m_in_constructor);
m_connections.insert(c); m_connections.insert(c);
@ -936,7 +933,7 @@ namespace aux {
i->second->port_filter_updated(); i->second->port_filter_updated();
} }
void session_impl::set_ip_filter(boost::shared_ptr<ip_filter> const& f) void session_impl::set_ip_filter(std::shared_ptr<ip_filter> const& f)
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
@ -952,7 +949,7 @@ namespace aux {
void session_impl::ban_ip(address addr) void session_impl::ban_ip(address addr)
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
if (!m_ip_filter) m_ip_filter = boost::make_shared<ip_filter>(); if (!m_ip_filter) m_ip_filter = std::make_shared<ip_filter>();
m_ip_filter->add_rule(addr, addr, ip_filter::blocked); m_ip_filter->add_rule(addr, addr, ip_filter::blocked);
for (torrent_map::iterator i = m_torrents.begin() for (torrent_map::iterator i = m_torrents.begin()
, end(m_torrents.end()); i != end; ++i) , end(m_torrents.end()); i != end; ++i)
@ -962,7 +959,7 @@ namespace aux {
ip_filter const& session_impl::get_ip_filter() ip_filter const& session_impl::get_ip_filter()
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
if (!m_ip_filter) m_ip_filter = boost::make_shared<ip_filter>(); if (!m_ip_filter) m_ip_filter = std::make_shared<ip_filter>();
return *m_ip_filter; return *m_ip_filter;
} }
@ -1369,7 +1366,7 @@ namespace aux {
} }
// session_impl is responsible for deleting 'pack' // session_impl is responsible for deleting 'pack'
void session_impl::apply_settings_pack(boost::shared_ptr<settings_pack> pack) void session_impl::apply_settings_pack(std::shared_ptr<settings_pack> pack)
{ {
apply_settings_pack_impl(*pack); apply_settings_pack_impl(*pack);
} }
@ -1427,7 +1424,7 @@ namespace aux {
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
boost::shared_ptr<settings_pack> p = load_pack_from_struct(m_settings, s); std::shared_ptr<settings_pack> p = load_pack_from_struct(m_settings, s);
apply_settings_pack(p); apply_settings_pack(p);
} }
@ -2768,9 +2765,8 @@ namespace aux {
pack.endp = endp; pack.endp = endp;
pack.peerinfo = nullptr; pack.peerinfo = nullptr;
boost::shared_ptr<peer_connection> c std::shared_ptr<peer_connection> c
= boost::make_shared<bt_peer_connection>(boost::cref(pack) = std::make_shared<bt_peer_connection>(pack, get_peer_id());
, get_peer_id());
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
c->m_in_constructor = false; c->m_in_constructor = false;
#endif #endif
@ -2803,7 +2799,7 @@ namespace aux {
, error_code const& ec) , error_code const& ec)
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
boost::shared_ptr<peer_connection> sp(p->self()); std::shared_ptr<peer_connection> sp(p->self());
// someone else is holding a reference, it's important that // someone else is holding a reference, it's important that
// it's destructed from the network thread. Make sure the // it's destructed from the network thread. Make sure the
@ -2903,7 +2899,7 @@ namespace aux {
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
return std::any_of(m_connections.begin(), m_connections.end() return std::any_of(m_connections.begin(), m_connections.end()
, [p] (boost::shared_ptr<peer_connection> const& pr) , [p] (std::shared_ptr<peer_connection> const& pr)
{ return pr.get() == p; }); { return pr.get() == p; });
} }
@ -2966,9 +2962,9 @@ namespace aux {
// remove undead peers that only have this list as their reference keeping them alive // remove undead peers that only have this list as their reference keeping them alive
if (!m_undead_peers.empty()) if (!m_undead_peers.empty())
{ {
std::vector<boost::shared_ptr<peer_connection> >::iterator remove_it std::vector<std::shared_ptr<peer_connection> >::iterator remove_it
= std::remove_if(m_undead_peers.begin(), m_undead_peers.end() = std::remove_if(m_undead_peers.begin(), m_undead_peers.end()
, std::bind(&boost::shared_ptr<peer_connection>::unique, _1)); , std::bind(&std::shared_ptr<peer_connection>::unique, _1));
m_undead_peers.erase(remove_it, m_undead_peers.end()); m_undead_peers.erase(remove_it, m_undead_peers.end());
if (m_undead_peers.empty()) if (m_undead_peers.empty())
{ {
@ -3681,11 +3677,11 @@ namespace aux {
struct opt_unchoke_candidate struct opt_unchoke_candidate
{ {
explicit opt_unchoke_candidate(boost::shared_ptr<peer_connection> const* tp) explicit opt_unchoke_candidate(std::shared_ptr<peer_connection> const* tp)
: peer(tp) : peer(tp)
{} {}
boost::shared_ptr<peer_connection> const* peer; std::shared_ptr<peer_connection> const* peer;
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
// this is mutable because comparison functors passed to std::partial_sort // this is mutable because comparison functors passed to std::partial_sort
// are not supposed to modify the elements they are sorting. Here the mutation // are not supposed to modify the elements they are sorting. Here the mutation
@ -4035,7 +4031,7 @@ namespace aux {
for (connection_map::iterator i = m_connections.begin(); for (connection_map::iterator i = m_connections.begin();
i != m_connections.end();) i != m_connections.end();)
{ {
boost::shared_ptr<peer_connection> p = *i; std::shared_ptr<peer_connection> p = *i;
TORRENT_ASSERT(p); TORRENT_ASSERT(p);
++i; ++i;
torrent* const t = p->associated_torrent().lock().get(); torrent* const t = p->associated_torrent().lock().get();
@ -4832,9 +4828,9 @@ namespace aux {
int queue_pos = ++m_max_queue_pos; int queue_pos = ++m_max_queue_pos;
torrent_ptr = std::make_shared<torrent>(std::ref(*this) torrent_ptr = std::make_shared<torrent>(*this
, 16 * 1024, queue_pos, m_paused , 16 * 1024, queue_pos, m_paused
, boost::cref(params), boost::cref(params.info_hash)); , params, params.info_hash);
return std::make_pair(torrent_ptr, true); return std::make_pair(torrent_ptr, true);
} }
@ -6649,7 +6645,7 @@ namespace aux {
} }
disk_buffer_holder session_impl::allocate_disk_buffer(bool& exceeded disk_buffer_holder session_impl::allocate_disk_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o , std::shared_ptr<disk_observer> o
, char const* category) , char const* category)
{ {
return m_disk_thread.allocate_disk_buffer(exceeded, o, category); return m_disk_thread.allocate_disk_buffer(exceeded, o, category);
@ -6794,7 +6790,7 @@ namespace aux {
} }
} }
for (std::vector<boost::shared_ptr<peer_connection> >::const_iterator i for (std::vector<std::shared_ptr<peer_connection> >::const_iterator i
= m_undead_peers.begin(); i != m_undead_peers.end(); ++i) = m_undead_peers.begin(); i != m_undead_peers.end(); ++i)
{ {
peer_connection* p = i->get(); peer_connection* p = i->get();

View File

@ -388,9 +388,9 @@ namespace libtorrent
return ""; return "";
} }
boost::shared_ptr<settings_pack> load_pack_from_dict(bdecode_node const& settings) std::shared_ptr<settings_pack> load_pack_from_dict(bdecode_node const& settings)
{ {
boost::shared_ptr<settings_pack> pack = boost::make_shared<settings_pack>(); std::shared_ptr<settings_pack> pack = std::make_shared<settings_pack>();
for (int i = 0; i < settings.dict_size(); ++i) for (int i = 0; i < settings.dict_size(); ++i)
{ {
@ -463,10 +463,10 @@ namespace libtorrent
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
boost::shared_ptr<settings_pack> load_pack_from_struct( std::shared_ptr<settings_pack> load_pack_from_struct(
aux::session_settings const& current, session_settings const& s) aux::session_settings const& current, session_settings const& s)
{ {
boost::shared_ptr<settings_pack> p = boost::make_shared<settings_pack>(); std::shared_ptr<settings_pack> p = std::make_shared<settings_pack>();
for (int i = 0; i < settings_pack::num_string_settings; ++i) for (int i = 0; i < settings_pack::num_string_settings; ++i)
{ {

View File

@ -46,8 +46,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/make_shared.hpp>
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
#include "libtorrent/ssl_stream.hpp" #include "libtorrent/ssl_stream.hpp"
#include <boost/asio/ssl/context.hpp> #include <boost/asio/ssl/context.hpp>
@ -774,7 +772,7 @@ namespace libtorrent
state_updated(); state_updated();
} }
void torrent::set_ip_filter(boost::shared_ptr<const ip_filter> ipf) void torrent::set_ip_filter(std::shared_ptr<const ip_filter> ipf)
{ {
m_ip_filter = ipf; m_ip_filter = ipf;
if (!m_apply_ip_filter) return; if (!m_apply_ip_filter) return;
@ -883,7 +881,7 @@ namespace libtorrent
return; return;
} }
boost::shared_ptr<read_piece_struct> rp = boost::make_shared<read_piece_struct>(); std::shared_ptr<read_piece_struct> rp = std::make_shared<read_piece_struct>();
rp->piece_data.reset(new (std::nothrow) char[piece_size]); rp->piece_data.reset(new (std::nothrow) char[piece_size]);
rp->blocks_left = 0; rp->blocks_left = 0;
rp->fail = false; rp->fail = false;
@ -938,7 +936,7 @@ namespace libtorrent
bt_peer_connection* p = static_cast<bt_peer_connection*>(*i); bt_peer_connection* p = static_cast<bt_peer_connection*>(*i);
if (p->type() == peer_connection::bittorrent_connection) if (p->type() == peer_connection::bittorrent_connection)
{ {
boost::shared_ptr<peer_connection> me(p->self()); std::shared_ptr<peer_connection> me(p->self());
if (!p->is_disconnecting()) if (!p->is_disconnecting())
{ {
p->send_not_interested(); p->send_not_interested();
@ -1163,7 +1161,7 @@ namespace libtorrent
} }
void torrent::on_disk_read_complete(disk_io_job const* j, peer_request r void torrent::on_disk_read_complete(disk_io_job const* j, peer_request r
, boost::shared_ptr<read_piece_struct> rp) , std::shared_ptr<read_piece_struct> rp)
{ {
// hold a reference until this function returns // hold a reference until this function returns
torrent_ref_holder h(this, "read_piece"); torrent_ref_holder h(this, "read_piece");
@ -1557,7 +1555,7 @@ namespace libtorrent
// create the SSL context for this torrent. We need to // create the SSL context for this torrent. We need to
// inject the root certificate, and no other, to // inject the root certificate, and no other, to
// verify other peers against // verify other peers against
boost::shared_ptr<context> ctx = boost::make_shared<context>(std::ref(m_ses.get_io_service()), context::sslv23); std::shared_ptr<context> ctx = std::make_shared<context>(m_ses.get_io_service(), context::sslv23);
if (!ctx) if (!ctx)
{ {
@ -2661,7 +2659,7 @@ namespace libtorrent
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
void torrent::use_interface(std::string net_interfaces) void torrent::use_interface(std::string net_interfaces)
{ {
boost::shared_ptr<settings_pack> p = boost::make_shared<settings_pack>(); std::shared_ptr<settings_pack> p = std::make_shared<settings_pack>();
p->set_str(settings_pack::outgoing_interfaces, net_interfaces); p->set_str(settings_pack::outgoing_interfaces, net_interfaces);
m_ses.apply_settings_pack(p); m_ses.apply_settings_pack(p);
} }
@ -4031,7 +4029,7 @@ namespace libtorrent
for (peer_iterator i = peers.begin(); i != peers.end(); ++i) for (peer_iterator i = peers.begin(); i != peers.end(); ++i)
{ {
boost::shared_ptr<peer_connection> p = (*i)->self(); std::shared_ptr<peer_connection> p = (*i)->self();
// received_piece will check to see if we're still interested // received_piece will check to see if we're still interested
// in this peer, and if neither of us is interested in the other, // in this peer, and if neither of us is interested in the other,
@ -6180,7 +6178,7 @@ namespace libtorrent
return; return;
} }
boost::shared_ptr<peer_connection> c; std::shared_ptr<peer_connection> c;
peer_connection_args pack; peer_connection_args pack;
pack.ses = &m_ses; pack.ses = &m_ses;
pack.sett = &settings(); pack.sett = &settings();
@ -6194,13 +6192,11 @@ namespace libtorrent
pack.peerinfo = &web->peer_info; pack.peerinfo = &web->peer_info;
if (web->type == web_seed_entry::url_seed) if (web->type == web_seed_entry::url_seed)
{ {
c = boost::make_shared<web_peer_connection>( c = std::make_shared<web_peer_connection>(pack, *web);
boost::cref(pack), std::ref(*web));
} }
else if (web->type == web_seed_entry::http_seed) else if (web->type == web_seed_entry::http_seed)
{ {
c = boost::make_shared<http_seed_connection>( c = std::make_shared<http_seed_connection>(pack, *web);
boost::cref(pack), std::ref(*web));
} }
if (!c) return; if (!c) return;
@ -6892,8 +6888,8 @@ namespace libtorrent
pack.endp = a; pack.endp = a;
pack.peerinfo = peerinfo; pack.peerinfo = peerinfo;
boost::shared_ptr<peer_connection> c = boost::make_shared<bt_peer_connection>( std::shared_ptr<peer_connection> c = std::make_shared<bt_peer_connection>(
boost::cref(pack), m_ses.get_peer_id()); pack, m_ses.get_peer_id());
TORRENT_TRY TORRENT_TRY
{ {
@ -8737,7 +8733,7 @@ namespace libtorrent
state_updated(); state_updated();
boost::shared_ptr<entry> rd(new entry); std::shared_ptr<entry> rd(new entry);
write_resume_data(*rd); write_resume_data(*rd);
alerts().emplace_alert<save_resume_data_alert>(rd, get_handle()); alerts().emplace_alert<save_resume_data_alert>(rd, get_handle());
} }
@ -9388,7 +9384,7 @@ namespace libtorrent
{ {
// keep the peer object alive while we're // keep the peer object alive while we're
// inspecting it // inspecting it
boost::shared_ptr<peer_connection> p = (*i)->self(); std::shared_ptr<peer_connection> p = (*i)->self();
++i; ++i;
// look for the peer that saw a seed most recently // look for the peer that saw a seed most recently

View File

@ -30,16 +30,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <cctype> #include <cctype>
#include <functional> #include <functional>
#include <boost/make_shared.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/tracker_manager.hpp" #include "libtorrent/tracker_manager.hpp"
#include "libtorrent/http_tracker_connection.hpp" #include "libtorrent/http_tracker_connection.hpp"

View File

@ -40,8 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/parse_url.hpp" #include "libtorrent/parse_url.hpp"
#include "libtorrent/peer_info.hpp" #include "libtorrent/peer_info.hpp"
using boost::shared_ptr;
namespace libtorrent namespace libtorrent
{ {
web_connection_base::web_connection_base( web_connection_base::web_connection_base(

View File

@ -59,8 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/escape_string.hpp" // for escape_path #include "libtorrent/aux_/escape_string.hpp" // for escape_path
#include "libtorrent/hex.hpp" // for is_hex #include "libtorrent/hex.hpp" // for is_hex
using boost::shared_ptr;
namespace libtorrent namespace libtorrent
{ {
enum enum
@ -426,7 +424,7 @@ void web_peer_connection::write_request(peer_request const& r)
{ {
get_io_service().post(std::bind( get_io_service().post(std::bind(
&web_peer_connection::on_receive_padfile, &web_peer_connection::on_receive_padfile,
boost::static_pointer_cast<web_peer_connection>(self()))); std::static_pointer_cast<web_peer_connection>(self())));
return; return;
} }

View File

@ -41,8 +41,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test_utils.hpp" #include "test_utils.hpp"
#include <boost/detail/atomic_count.hpp> #include <boost/detail/atomic_count.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#if TORRENT_USE_IOSTREAM #if TORRENT_USE_IOSTREAM
#include <iostream> #include <iostream>
@ -50,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <thread> #include <thread>
#include <functional> #include <functional>
#include <memory>
using namespace libtorrent; using namespace libtorrent;
using namespace std::placeholders; using namespace std::placeholders;
@ -62,7 +61,7 @@ struct dht_server
udp::socket m_socket; udp::socket m_socket;
int m_port; int m_port;
boost::shared_ptr<std::thread> m_thread; std::shared_ptr<std::thread> m_thread;
dht_server() dht_server()
: m_dht_requests(0) : m_dht_requests(0)
@ -92,7 +91,7 @@ struct dht_server
std::fprintf(stderr, "%s: DHT initialized on port %d\n", time_now_string(), m_port); std::fprintf(stderr, "%s: DHT initialized on port %d\n", time_now_string(), m_port);
m_thread = boost::make_shared<std::thread>(&dht_server::thread_fun, this); m_thread = std::make_shared<std::thread>(&dht_server::thread_fun, this);
} }
~dht_server() ~dht_server()
@ -158,7 +157,7 @@ struct dht_server
} }
}; };
boost::shared_ptr<dht_server> g_dht; std::shared_ptr<dht_server> g_dht;
int start_dht() int start_dht()
{ {

View File

@ -42,12 +42,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test_utils.hpp" #include "test_utils.hpp"
#include <boost/detail/atomic_count.hpp> #include <boost/detail/atomic_count.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <functional> #include <functional>
#include <thread> #include <thread>
#include <condition_variable> #include <condition_variable>
#include <memory>
using namespace libtorrent; using namespace libtorrent;
using namespace std::placeholders; using namespace std::placeholders;
@ -148,7 +147,7 @@ struct peer_server
} }
}; };
boost::shared_ptr<peer_server> g_peer; std::shared_ptr<peer_server> g_peer;
int start_peer() int start_peer()
{ {

View File

@ -41,10 +41,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp" #include "libtorrent/time.hpp"
#include "libtorrent/aux_/session_settings.hpp" #include "libtorrent/aux_/session_settings.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
@ -62,7 +58,7 @@ const float sample_time = 20.f; // seconds
bandwidth_channel global_bwc; bandwidth_channel global_bwc;
struct peer_connection: bandwidth_socket, boost::enable_shared_from_this<peer_connection> struct peer_connection: bandwidth_socket, std::enable_shared_from_this<peer_connection>
{ {
peer_connection(bandwidth_manager& bwm peer_connection(bandwidth_manager& bwm
, bandwidth_channel& torrent_bwc, int prio, bool ignore_limits, std::string name) , bandwidth_channel& torrent_bwc, int prio, bool ignore_limits, std::string name)
@ -116,7 +112,7 @@ void peer_connection::start()
} }
typedef std::vector<boost::shared_ptr<peer_connection>> connections_t; typedef std::vector<std::shared_ptr<peer_connection>> connections_t;
void do_change_rate(bandwidth_channel& t1, bandwidth_channel& t2, int limit) void do_change_rate(bandwidth_channel& t1, bandwidth_channel& t2, int limit)
{ {
@ -183,7 +179,7 @@ void spawn_connections(connections_t& v, bandwidth_manager& bwm
{ {
char name[200]; char name[200];
std::snprintf(name, sizeof(name), "%s%d", prefix, i); std::snprintf(name, sizeof(name), "%s%d", prefix, i);
v.push_back(boost::make_shared<peer_connection>(bwm, bwc, 200, false, name)); v.push_back(std::make_shared<peer_connection>(bwm, bwc, 200, false, name));
} }
} }
@ -403,8 +399,8 @@ void test_peer_priority(int limit, bool torrent_limit)
spawn_connections(v1, manager, t1, 10, "p"); spawn_connections(v1, manager, t1, 10, "p");
connections_t v; connections_t v;
std::copy(v1.begin(), v1.end(), std::back_inserter(v)); std::copy(v1.begin(), v1.end(), std::back_inserter(v));
boost::shared_ptr<peer_connection> p = std::shared_ptr<peer_connection> p =
boost::make_shared<peer_connection>(manager, t1, 1, false, "no-priority"); std::make_shared<peer_connection>(manager, t1, 1, false, "no-priority");
v.push_back(p); v.push_back(p);
run_test(v, manager); run_test(v, manager);
@ -439,8 +435,8 @@ void test_no_starvation(int limit)
spawn_connections(v1, manager, t1, num_peers, "p"); spawn_connections(v1, manager, t1, num_peers, "p");
connections_t v; connections_t v;
std::copy(v1.begin(), v1.end(), std::back_inserter(v)); std::copy(v1.begin(), v1.end(), std::back_inserter(v));
boost::shared_ptr<peer_connection> p = std::shared_ptr<peer_connection> p =
boost::make_shared<peer_connection>(manager, t2, 1, false, "no-priority"); std::make_shared<peer_connection>(manager, t2, 1, false, "no-priority");
v.push_back(p); v.push_back(p);
run_test(v, manager); run_test(v, manager);

View File

@ -40,8 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/session.hpp" #include "libtorrent/session.hpp"
#include <functional> #include <functional>
#include <boost/shared_ptr.hpp> #include <memory>
#include <boost/make_shared.hpp>
using namespace libtorrent; using namespace libtorrent;

View File

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/create_torrent.hpp" #include "libtorrent/create_torrent.hpp"
#include "libtorrent/bencode.hpp" #include "libtorrent/bencode.hpp"
#include "libtorrent/aux_/escape_string.hpp" // for convert_path_to_posix #include "libtorrent/aux_/escape_string.hpp" // for convert_path_to_posix
#include <boost/make_shared.hpp>
#include <cstring> #include <cstring>
namespace lt = libtorrent; namespace lt = libtorrent;

View File

@ -405,7 +405,7 @@ entry read_ut_metadata_msg(tcp::socket& s, char* recv_buffer, int size)
} }
std::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih std::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih
, boost::shared_ptr<lt::session>& ses, bool incoming = true , std::shared_ptr<lt::session>& ses, bool incoming = true
, int flags = 0, torrent_handle* th = nullptr) , int flags = 0, torrent_handle* th = nullptr)
{ {
std::shared_ptr<torrent_info> t = ::create_torrent(); std::shared_ptr<torrent_info> t = ::create_torrent();
@ -473,7 +473,7 @@ TORRENT_TEST(reject_fast)
std::cerr << "\n === test reject ===\n" << std::endl; std::cerr << "\n === test reject ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
setup_peer(s, ih, ses); setup_peer(s, ih, ses);
@ -542,7 +542,7 @@ TORRENT_TEST(invalid_suggest)
std::cerr << "\n === test suggest ===\n" << std::endl; std::cerr << "\n === test suggest ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
setup_peer(s, ih, ses); setup_peer(s, ih, ses);
@ -582,7 +582,7 @@ TORRENT_TEST(reject_suggest)
std::cerr << "\n === test suggest ===\n" << std::endl; std::cerr << "\n === test suggest ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
setup_peer(s, ih, ses); setup_peer(s, ih, ses);
@ -661,7 +661,7 @@ TORRENT_TEST(suggest_order)
std::cerr << "\n === test suggest ===\n" << std::endl; std::cerr << "\n === test suggest ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
setup_peer(s, ih, ses); setup_peer(s, ih, ses);
@ -721,7 +721,7 @@ TORRENT_TEST(multiple_bitfields)
std::cerr << "\n === test multiple bitfields ===\n" << std::endl; std::cerr << "\n === test multiple bitfields ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses); std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
@ -755,7 +755,7 @@ TORRENT_TEST(multiple_have_all)
std::cerr << "\n === test multiple have_all ===\n" << std::endl; std::cerr << "\n === test multiple have_all ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses); std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
@ -790,7 +790,7 @@ TORRENT_TEST(dont_have)
sha1_hash ih; sha1_hash ih;
torrent_handle th; torrent_handle th;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses, true, 0, &th); std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses, true, 0, &th);
@ -892,7 +892,7 @@ TORRENT_TEST(invalid_metadata_request)
std::cerr << "\n === test invalid metadata ===\n" << std::endl; std::cerr << "\n === test invalid metadata ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses); std::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
@ -945,7 +945,7 @@ TORRENT_TEST(invalid_request)
std::cerr << "\n === test request ===\n" << std::endl; std::cerr << "\n === test request ===\n" << std::endl;
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
setup_peer(s, ih, ses); setup_peer(s, ih, ses);
@ -965,7 +965,7 @@ TORRENT_TEST(invalid_request)
void have_all_test(bool const incoming) void have_all_test(bool const incoming)
{ {
sha1_hash ih; sha1_hash ih;
boost::shared_ptr<lt::session> ses; std::shared_ptr<lt::session> ses;
io_service ios; io_service ios;
tcp::socket s(ios); tcp::socket s(ios);
setup_peer(s, ih, ses, incoming, add_torrent_params::flag_seed_mode); setup_peer(s, ih, ses, incoming, add_torrent_params::flag_seed_mode);

View File

@ -35,10 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket_io.hpp" #include "libtorrent/socket_io.hpp"
#include <functional> #include <functional>
#include <iostream> #include <iostream>
#include <memory>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/ref.hpp>
using namespace libtorrent; using namespace libtorrent;
@ -68,7 +65,7 @@ int main(int argc, char* argv[])
return 1; return 1;
} }
boost::shared_ptr<natpmp> natpmp_handler(new natpmp( std::shared_ptr<natpmp> natpmp_handler(new natpmp(
ios, &callback, &log_callback)); ios, &callback, &log_callback));
deadline_timer timer(ios); deadline_timer timer(ios);

View File

@ -36,12 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp" #include "libtorrent/performance_counters.hpp"
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp" #include <memory>
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
@ -109,7 +104,7 @@ namespace {
// have_str is a string where each character represents a // have_str is a string where each character represents a
// piece, ' ' means we don't have the piece and any other // piece, ' ' means we don't have the piece and any other
// character means we have it // character means we have it
boost::shared_ptr<piece_picker> setup_picker( std::shared_ptr<piece_picker> setup_picker(
char const* availability char const* availability
, char const* have_str , char const* have_str
, char const* priority , char const* priority
@ -118,7 +113,7 @@ boost::shared_ptr<piece_picker> setup_picker(
const int num_pieces = int(strlen(availability)); const int num_pieces = int(strlen(availability));
TORRENT_ASSERT(int(strlen(have_str)) == num_pieces); TORRENT_ASSERT(int(strlen(have_str)) == num_pieces);
boost::shared_ptr<piece_picker> p(new piece_picker); std::shared_ptr<piece_picker> p(new piece_picker);
p->init(blocks_per_piece, blocks_per_piece, num_pieces); p->init(blocks_per_piece, blocks_per_piece, num_pieces);
for (int i = 0; i < num_pieces; ++i) for (int i = 0; i < num_pieces; ++i)
@ -212,7 +207,7 @@ boost::shared_ptr<piece_picker> setup_picker(
return p; return p;
} }
bool verify_pick(boost::shared_ptr<piece_picker> p bool verify_pick(std::shared_ptr<piece_picker> p
, std::vector<piece_block> const& picked, bool allow_multi_blocks = false) , std::vector<piece_block> const& picked, bool allow_multi_blocks = false)
{ {
#if TORRENT_USE_INVARIANT_CHECKS #if TORRENT_USE_INVARIANT_CHECKS
@ -235,7 +230,7 @@ bool verify_pick(boost::shared_ptr<piece_picker> p
return picked.size() == blocks.size(); return picked.size() == blocks.size();
} }
void print_availability(boost::shared_ptr<piece_picker> const& p) void print_availability(std::shared_ptr<piece_picker> const& p)
{ {
std::vector<int> avail; std::vector<int> avail;
p->get_availability(avail); p->get_availability(avail);
@ -248,7 +243,7 @@ void print_availability(boost::shared_ptr<piece_picker> const& p)
std::printf("]\n"); std::printf("]\n");
} }
bool verify_availability(boost::shared_ptr<piece_picker> const& p, char const* a) bool verify_availability(std::shared_ptr<piece_picker> const& p, char const* a)
{ {
std::vector<int> avail; std::vector<int> avail;
p->get_availability(avail); p->get_availability(avail);
@ -269,7 +264,7 @@ void print_pick(std::vector<piece_block> const& picked)
std::cout << std::endl; std::cout << std::endl;
} }
std::vector<piece_block> pick_pieces(boost::shared_ptr<piece_picker> const& p std::vector<piece_block> pick_pieces(std::shared_ptr<piece_picker> const& p
, char const* availability , char const* availability
, int num_blocks , int num_blocks
, int prefer_contiguous_blocks , int prefer_contiguous_blocks
@ -287,7 +282,7 @@ std::vector<piece_block> pick_pieces(boost::shared_ptr<piece_picker> const& p
return picked; return picked;
} }
int test_pick(boost::shared_ptr<piece_picker> const& p int test_pick(std::shared_ptr<piece_picker> const& p
, int options = piece_picker::rarest_first) , int options = piece_picker::rarest_first)
{ {
const std::vector<int> empty_vector; const std::vector<int> empty_vector;

View File

@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_info.hpp" #include "libtorrent/torrent_info.hpp"
#include "libtorrent/read_resume_data.hpp" #include "libtorrent/read_resume_data.hpp"
#include <boost/make_shared.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <iostream> #include <iostream>
@ -118,7 +117,7 @@ void run_until(io_service& ios, bool const& done)
void nop() {} void nop() {}
boost::shared_ptr<default_storage> setup_torrent(file_storage& fs std::shared_ptr<default_storage> setup_torrent(file_storage& fs
, file_pool& fp , file_pool& fp
, std::vector<char>& buf , std::vector<char>& buf
, std::string const& test_path , std::string const& test_path
@ -152,7 +151,7 @@ boost::shared_ptr<default_storage> setup_torrent(file_storage& fs
p.pool = &fp; p.pool = &fp;
p.path = test_path; p.path = test_path;
p.mode = storage_mode_allocate; p.mode = storage_mode_allocate;
boost::shared_ptr<default_storage> s(new default_storage(p)); std::shared_ptr<default_storage> s(new default_storage(p));
s->m_settings = &set; s->m_settings = &set;
// allocate the files and create the directories // allocate the files and create the directories
@ -316,7 +315,7 @@ void test_remove(std::string const& test_path, bool unbuffered)
, unbuffered ? settings_pack::disable_os_cache , unbuffered ? settings_pack::disable_os_cache
: settings_pack::enable_os_cache); : settings_pack::enable_os_cache);
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, test_path, set); std::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, test_path, set);
// directories are not created up-front, unless they contain // directories are not created up-front, unless they contain
// an empty file (all of which are created up-front, along with // an empty file (all of which are created up-front, along with
@ -382,7 +381,7 @@ void test_rename(std::string const& test_path)
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop)); disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
aux::session_settings set; aux::session_settings set;
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, test_path std::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, test_path
, set); , set);
// directories are not created up-front, unless they contain // directories are not created up-front, unless they contain
@ -1285,7 +1284,7 @@ TORRENT_TEST(move_storage_into_self)
file_pool fp; file_pool fp;
io_service ios; io_service ios;
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop)); disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, save_path, set); std::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, save_path, set);
file::iovec_t const b = {&buf[0], 4}; file::iovec_t const b = {&buf[0], 4};
storage_error se; storage_error se;
@ -1331,7 +1330,7 @@ TORRENT_TEST(dont_move_intermingled_files)
file_pool fp; file_pool fp;
io_service ios; io_service ios;
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop)); disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, save_path, set); std::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, save_path, set);
file::iovec_t b = {&buf[0], 4}; file::iovec_t b = {&buf[0], 4};
storage_error se; storage_error se;

View File

@ -476,7 +476,7 @@ TORRENT_TEST(current_tracker)
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:39775"); pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:39775");
//pack.set_int(settings_pack::alert_mask, alert::tracker_notification); //pack.set_int(settings_pack::alert_mask, alert::tracker_notification);
boost::scoped_ptr<lt::session> s(new lt::session(pack)); std::unique_ptr<lt::session> s(new lt::session(pack));
error_code ec; error_code ec;
remove_all("tmp3_tracker", ec); remove_all("tmp3_tracker", ec);

View File

@ -38,9 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <fstream> #include <fstream>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
#include <memory>
#include <boost/smart_ptr.hpp>
#include <boost/ref.hpp>
namespace lt = libtorrent; namespace lt = libtorrent;
using namespace libtorrent; using namespace libtorrent;

View File

@ -43,11 +43,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test_utils.hpp" #include "test_utils.hpp"
#include <boost/detail/atomic_count.hpp> #include <boost/detail/atomic_count.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <functional> #include <functional>
#include <thread> #include <thread>
#include <memory>
using namespace libtorrent; using namespace libtorrent;
using namespace std::placeholders; using namespace std::placeholders;
@ -61,7 +60,7 @@ struct udp_tracker
int m_port; int m_port;
bool m_abort; bool m_abort;
boost::shared_ptr<std::thread> m_thread; std::shared_ptr<std::thread> m_thread;
void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoint* from, char* buffer, int size) void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoint* from, char* buffer, int size)
{ {
@ -170,7 +169,7 @@ struct udp_tracker
std::fprintf(stderr, "%s: UDP tracker initialized on port %d\n", time_now_string(), m_port); std::fprintf(stderr, "%s: UDP tracker initialized on port %d\n", time_now_string(), m_port);
m_thread = boost::make_shared<std::thread>(&udp_tracker::thread_fun, this); m_thread = std::make_shared<std::thread>(&udp_tracker::thread_fun, this);
} }
void stop() void stop()
@ -219,7 +218,7 @@ struct udp_tracker
} }
}; };
boost::shared_ptr<udp_tracker> g_udp_tracker; std::shared_ptr<udp_tracker> g_udp_tracker;
int start_udp_tracker() int start_udp_tracker()
{ {