remove use of strand
This commit is contained in:
parent
630ad7cc85
commit
695cd6407b
|
@ -411,7 +411,6 @@ namespace libtorrent
|
|||
// the selector can sleep while there's no activity on
|
||||
// them
|
||||
io_service m_io_service;
|
||||
asio::strand m_strand;
|
||||
|
||||
// this is a list of half-open tcp connections
|
||||
// (only outgoing connections)
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace libtorrent
|
|||
public:
|
||||
|
||||
http_tracker_connection(
|
||||
asio::strand& str
|
||||
io_service& ios
|
||||
, connection_queue& cc
|
||||
, tracker_manager& man
|
||||
, tracker_request const& req
|
||||
|
@ -162,7 +162,6 @@ namespace libtorrent
|
|||
tracker_manager& m_man;
|
||||
http_parser m_parser;
|
||||
|
||||
asio::strand& m_strand;
|
||||
tcp::resolver m_name_lookup;
|
||||
int m_port;
|
||||
socket_type m_socket;
|
||||
|
|
|
@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
#include <asio/io_service.hpp>
|
||||
#include <asio/deadline_timer.hpp>
|
||||
#include <asio/write.hpp>
|
||||
#include <asio/strand.hpp>
|
||||
|
||||
#ifdef __OBJC__
|
||||
#undef Protocol
|
||||
|
|
|
@ -50,7 +50,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <asio/io_service.hpp>
|
||||
#include <asio/deadline_timer.hpp>
|
||||
#include <asio/write.hpp>
|
||||
#include <asio/strand.hpp>
|
||||
#include <asio/time_traits.hpp>
|
||||
#include <asio/basic_deadline_timer.hpp>
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace libtorrent
|
|||
: intrusive_ptr_base<timeout_handler>
|
||||
, boost::noncopyable
|
||||
{
|
||||
timeout_handler(asio::strand& str);
|
||||
timeout_handler(io_service& str);
|
||||
|
||||
void set_timeout(int completion_timeout, int read_timeout);
|
||||
void restart_read_timeout();
|
||||
|
@ -169,7 +169,6 @@ namespace libtorrent
|
|||
boost::intrusive_ptr<timeout_handler> self()
|
||||
{ return boost::intrusive_ptr<timeout_handler>(this); }
|
||||
|
||||
asio::strand& m_strand;
|
||||
// used for timeouts
|
||||
// this is set when the request has been sent
|
||||
ptime m_start_time;
|
||||
|
@ -191,7 +190,7 @@ namespace libtorrent
|
|||
{
|
||||
tracker_connection(tracker_manager& man
|
||||
, tracker_request const& req
|
||||
, asio::strand& str
|
||||
, io_service& ios
|
||||
, address bind_interface
|
||||
, boost::weak_ptr<request_callback> r);
|
||||
|
||||
|
@ -223,7 +222,7 @@ namespace libtorrent
|
|||
, m_abort(false) {}
|
||||
|
||||
void queue_request(
|
||||
asio::strand& str
|
||||
io_service& ios
|
||||
, connection_queue& cc
|
||||
, tracker_request r
|
||||
, std::string const& auth
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace libtorrent
|
|||
public:
|
||||
|
||||
udp_tracker_connection(
|
||||
asio::strand& str
|
||||
io_service& ios
|
||||
, tracker_manager& man
|
||||
, tracker_request const& req
|
||||
, std::string const& hostname
|
||||
|
@ -105,7 +105,6 @@ namespace libtorrent
|
|||
|
||||
tracker_manager& m_man;
|
||||
|
||||
asio::strand& m_strand;
|
||||
udp::resolver m_name_lookup;
|
||||
datagram_socket m_socket;
|
||||
udp::endpoint m_target;
|
||||
|
|
|
@ -222,8 +222,6 @@ private:
|
|||
|
||||
asio::io_service& m_io_service;
|
||||
|
||||
asio::strand m_strand;
|
||||
|
||||
// the udp socket used to send and receive
|
||||
// multicast messages on the network
|
||||
broadcast_socket m_socket;
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
http_tracker_connection::http_tracker_connection(
|
||||
asio::strand& str
|
||||
io_service& ios
|
||||
, connection_queue& cc
|
||||
, tracker_manager& man
|
||||
, tracker_request const& req
|
||||
|
@ -289,10 +289,9 @@ namespace libtorrent
|
|||
, session_settings const& stn
|
||||
, proxy_settings const& ps
|
||||
, std::string const& auth)
|
||||
: tracker_connection(man, req, str, bind_infc, c)
|
||||
: tracker_connection(man, req, ios, bind_infc, c)
|
||||
, m_man(man)
|
||||
, m_strand(str)
|
||||
, m_name_lookup(m_strand.io_service())
|
||||
, m_name_lookup(ios)
|
||||
, m_port(port)
|
||||
, m_recv_pos(0)
|
||||
, m_buffer(http_buffer_size)
|
||||
|
@ -486,8 +485,8 @@ namespace libtorrent
|
|||
|
||||
tcp::resolver::query q(hostname
|
||||
, boost::lexical_cast<std::string>(m_port));
|
||||
m_name_lookup.async_resolve(q, m_strand.wrap(
|
||||
boost::bind(&http_tracker_connection::name_lookup, self(), _1, _2)));
|
||||
m_name_lookup.async_resolve(q,
|
||||
boost::bind(&http_tracker_connection::name_lookup, self(), _1, _2));
|
||||
set_timeout(req.event == tracker_request::stopped
|
||||
? m_settings.stop_tracker_timeout
|
||||
: m_settings.tracker_completion_timeout
|
||||
|
@ -572,7 +571,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
if (cb) cb->m_tracker_address = target_address;
|
||||
bool ret = instantiate_connection(m_strand.io_service(), m_proxy, m_socket);
|
||||
bool ret = instantiate_connection(m_name_lookup.get_io_service(), m_proxy, m_socket);
|
||||
|
||||
TORRENT_ASSERT(ret);
|
||||
|
||||
|
@ -771,7 +770,7 @@ namespace libtorrent
|
|||
|
||||
req.url = location;
|
||||
|
||||
m_man.queue_request(m_strand, m_cc, req
|
||||
m_man.queue_request(m_name_lookup.get_io_service(), m_cc, req
|
||||
, m_password, bind_interface(), m_requester);
|
||||
close();
|
||||
return;
|
||||
|
|
|
@ -552,7 +552,6 @@ namespace detail
|
|||
)
|
||||
: m_send_buffers(send_buffer_size)
|
||||
, m_files(40)
|
||||
, m_strand(m_io_service)
|
||||
, m_half_open(m_io_service)
|
||||
, m_download_channel(m_io_service, peer_connection::download_channel)
|
||||
, m_upload_channel(m_io_service, peer_connection::upload_channel)
|
||||
|
@ -646,8 +645,8 @@ namespace detail
|
|||
}
|
||||
|
||||
m_timer.expires_from_now(seconds(1));
|
||||
m_timer.async_wait(m_strand.wrap(
|
||||
bind(&session_impl::second_tick, this, _1)));
|
||||
m_timer.async_wait(
|
||||
bind(&session_impl::second_tick, this, _1));
|
||||
|
||||
m_thread.reset(new boost::thread(boost::ref(*this)));
|
||||
m_checker_thread.reset(new boost::thread(boost::ref(m_checker_impl)));
|
||||
|
@ -733,10 +732,10 @@ namespace detail
|
|||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||
boost::shared_ptr<tracker_logger> tl(new tracker_logger(*this));
|
||||
m_tracker_loggers.push_back(tl);
|
||||
m_tracker_manager.queue_request(m_strand, m_half_open, req, login
|
||||
m_tracker_manager.queue_request(m_io_service, m_half_open, req, login
|
||||
, m_listen_interface.address(), tl);
|
||||
#else
|
||||
m_tracker_manager.queue_request(m_strand, m_half_open, req, login
|
||||
m_tracker_manager.queue_request(m_io_service, m_half_open, req, login
|
||||
, m_listen_interface.address());
|
||||
#endif
|
||||
}
|
||||
|
@ -1202,8 +1201,8 @@ namespace detail
|
|||
m_last_tick = time_now();
|
||||
|
||||
m_timer.expires_from_now(seconds(1));
|
||||
m_timer.async_wait(m_strand.wrap(
|
||||
bind(&session_impl::second_tick, this, _1)));
|
||||
m_timer.async_wait(
|
||||
bind(&session_impl::second_tick, this, _1));
|
||||
|
||||
#ifdef TORRENT_STATS
|
||||
++m_second_counter;
|
||||
|
@ -1347,7 +1346,7 @@ namespace detail
|
|||
if (!m_listen_sockets.empty())
|
||||
req.listen_port = m_listen_sockets.front().external_port;
|
||||
req.key = m_key;
|
||||
m_tracker_manager.queue_request(m_strand, m_half_open, req
|
||||
m_tracker_manager.queue_request(m_io_service, m_half_open, req
|
||||
, t.tracker_login(), m_listen_interface.address(), i->second);
|
||||
|
||||
if (m_alerts.should_post(alert::info))
|
||||
|
@ -1837,10 +1836,10 @@ namespace detail
|
|||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||
boost::shared_ptr<tracker_logger> tl(new tracker_logger(*this));
|
||||
m_tracker_loggers.push_back(tl);
|
||||
m_tracker_manager.queue_request(m_strand, m_half_open, req
|
||||
m_tracker_manager.queue_request(m_io_service, m_half_open, req
|
||||
, t.tracker_login(), m_listen_interface.address(), tl);
|
||||
#else
|
||||
m_tracker_manager.queue_request(m_strand, m_half_open, req
|
||||
m_tracker_manager.queue_request(m_io_service, m_half_open, req
|
||||
, t.tracker_login(), m_listen_interface.address());
|
||||
#endif
|
||||
|
||||
|
|
|
@ -286,8 +286,8 @@ namespace libtorrent
|
|||
if (m_torrent_file->is_valid()) init();
|
||||
if (m_abort) return;
|
||||
m_announce_timer.expires_from_now(seconds(1));
|
||||
m_announce_timer.async_wait(m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_announce_disp, self, _1)));
|
||||
m_announce_timer.async_wait(
|
||||
bind(&torrent::on_announce_disp, self, _1));
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
@ -440,8 +440,8 @@ namespace libtorrent
|
|||
{
|
||||
// announce on local network every 5 minutes
|
||||
m_announce_timer.expires_from_now(minutes(5));
|
||||
m_announce_timer.async_wait(m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_announce_disp, self, _1)));
|
||||
m_announce_timer.async_wait(
|
||||
bind(&torrent::on_announce_disp, self, _1));
|
||||
|
||||
// announce with the local discovery service
|
||||
if (!m_paused)
|
||||
|
@ -450,8 +450,8 @@ namespace libtorrent
|
|||
else
|
||||
{
|
||||
m_announce_timer.expires_from_now(minutes(15));
|
||||
m_announce_timer.async_wait(m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_announce_disp, self, _1)));
|
||||
m_announce_timer.async_wait(
|
||||
bind(&torrent::on_announce_disp, self, _1));
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
@ -463,7 +463,7 @@ namespace libtorrent
|
|||
m_last_dht_announce = now;
|
||||
m_ses.m_dht->announce(m_torrent_file->info_hash()
|
||||
, m_ses.m_listen_sockets.front().external_port
|
||||
, m_ses.m_strand.wrap(bind(&torrent::on_dht_announce_response_disp, self, _1)));
|
||||
, bind(&torrent::on_dht_announce_response_disp, self, _1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ namespace libtorrent
|
|||
req.info_hash = m_torrent_file->info_hash();
|
||||
req.kind = tracker_request::scrape_request;
|
||||
req.url = m_trackers[m_currently_trying_tracker].url;
|
||||
m_ses.m_tracker_manager.queue_request(m_ses.m_strand, m_ses.m_half_open, req
|
||||
m_ses.m_tracker_manager.queue_request(m_ses.m_io_service, m_ses.m_half_open, req
|
||||
, tracker_login(), m_ses.m_listen_interface.address(), shared_from_this());
|
||||
}
|
||||
|
||||
|
@ -643,8 +643,8 @@ namespace libtorrent
|
|||
// an ip address from the tracker
|
||||
|
||||
tcp::resolver::query q(i->ip, boost::lexical_cast<std::string>(i->port));
|
||||
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i->pid)));
|
||||
m_host_resolver.async_resolve(q,
|
||||
bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i->pid));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1656,8 +1656,8 @@ namespace libtorrent
|
|||
// use proxy
|
||||
tcp::resolver::query q(ps.hostname
|
||||
, boost::lexical_cast<std::string>(ps.port));
|
||||
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_proxy_name_lookup, shared_from_this(), _1, _2, url)));
|
||||
m_host_resolver.async_resolve(q,
|
||||
bind(&torrent::on_proxy_name_lookup, shared_from_this(), _1, _2, url));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1672,9 +1672,9 @@ namespace libtorrent
|
|||
// TODO: should auth be used here?
|
||||
|
||||
tcp::resolver::query q(hostname, boost::lexical_cast<std::string>(port));
|
||||
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
||||
m_host_resolver.async_resolve(q,
|
||||
bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, url
|
||||
, tcp::endpoint())));
|
||||
, tcp::endpoint()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1727,8 +1727,8 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
tcp::resolver::query q(hostname, boost::lexical_cast<std::string>(port));
|
||||
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, url, a)));
|
||||
m_host_resolver.async_resolve(q,
|
||||
bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, url, a));
|
||||
}
|
||||
catch (std::exception& exc)
|
||||
{
|
||||
|
@ -1860,8 +1860,8 @@ namespace libtorrent
|
|||
m_resolving_country = true;
|
||||
asio::ip::address_v4 reversed(swap_bytes(p->remote().address().to_v4().to_ulong()));
|
||||
tcp::resolver::query q(reversed.to_string() + ".zz.countries.nerd.dk", "0");
|
||||
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
||||
bind(&torrent::on_country_lookup, shared_from_this(), _1, _2, p)));
|
||||
m_host_resolver.async_resolve(q,
|
||||
bind(&torrent::on_country_lookup, shared_from_this(), _1, _2, p));
|
||||
}
|
||||
|
||||
namespace
|
||||
|
@ -2440,7 +2440,7 @@ namespace libtorrent
|
|||
boost::weak_ptr<torrent> self(shared_from_this());
|
||||
m_ses.m_dht->announce(m_torrent_file->info_hash()
|
||||
, m_ses.m_listen_sockets.front().external_port
|
||||
, m_ses.m_strand.wrap(bind(&torrent::on_dht_announce_response_disp, self, _1)));
|
||||
, bind(&torrent::on_dht_announce_response_disp, self, _1));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -234,11 +234,10 @@ namespace libtorrent
|
|||
return false;
|
||||
}
|
||||
|
||||
timeout_handler::timeout_handler(asio::strand& str)
|
||||
: m_strand(str)
|
||||
, m_start_time(time_now())
|
||||
timeout_handler::timeout_handler(io_service& ios)
|
||||
: m_start_time(time_now())
|
||||
, m_read_time(time_now())
|
||||
, m_timeout(str.io_service())
|
||||
, m_timeout(ios)
|
||||
, m_completion_timeout(0)
|
||||
, m_read_timeout(0)
|
||||
, m_abort(false)
|
||||
|
@ -256,8 +255,8 @@ namespace libtorrent
|
|||
m_read_timeout, (std::min)(m_completion_timeout, m_read_timeout));
|
||||
asio::error_code ec;
|
||||
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
||||
m_timeout.async_wait(m_strand.wrap(bind(
|
||||
&timeout_handler::timeout_callback, self(), _1)));
|
||||
m_timeout.async_wait(bind(
|
||||
&timeout_handler::timeout_callback, self(), _1));
|
||||
}
|
||||
|
||||
void timeout_handler::restart_read_timeout()
|
||||
|
@ -297,17 +296,17 @@ namespace libtorrent
|
|||
m_read_timeout, (std::min)(m_completion_timeout, m_read_timeout));
|
||||
asio::error_code ec;
|
||||
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
||||
m_timeout.async_wait(m_strand.wrap(
|
||||
bind(&timeout_handler::timeout_callback, self(), _1)));
|
||||
m_timeout.async_wait(
|
||||
bind(&timeout_handler::timeout_callback, self(), _1));
|
||||
}
|
||||
|
||||
tracker_connection::tracker_connection(
|
||||
tracker_manager& man
|
||||
, tracker_request const& req
|
||||
, asio::strand& str
|
||||
, io_service& ios
|
||||
, address bind_interface_
|
||||
, boost::weak_ptr<request_callback> r)
|
||||
: timeout_handler(str)
|
||||
: timeout_handler(ios)
|
||||
, m_requester(r)
|
||||
, m_bind_interface(bind_interface_)
|
||||
, m_man(man)
|
||||
|
@ -426,7 +425,7 @@ exit:
|
|||
}
|
||||
|
||||
void tracker_manager::queue_request(
|
||||
asio::strand& str
|
||||
io_service& ios
|
||||
, connection_queue& cc
|
||||
, tracker_request req
|
||||
, std::string const& auth
|
||||
|
@ -457,7 +456,7 @@ exit:
|
|||
if (protocol == "http")
|
||||
{
|
||||
con = new http_tracker_connection(
|
||||
str
|
||||
ios
|
||||
, cc
|
||||
, *this
|
||||
, req
|
||||
|
@ -473,7 +472,7 @@ exit:
|
|||
else if (protocol == "udp")
|
||||
{
|
||||
con = new udp_tracker_connection(
|
||||
str
|
||||
ios
|
||||
, *this
|
||||
, req
|
||||
, hostname
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace libtorrent
|
|||
{
|
||||
|
||||
udp_tracker_connection::udp_tracker_connection(
|
||||
asio::strand& str
|
||||
io_service& ios
|
||||
, tracker_manager& man
|
||||
, tracker_request const& req
|
||||
, std::string const& hostname
|
||||
|
@ -82,11 +82,10 @@ namespace libtorrent
|
|||
, address bind_infc
|
||||
, boost::weak_ptr<request_callback> c
|
||||
, session_settings const& stn)
|
||||
: tracker_connection(man, req, str, bind_infc, c)
|
||||
: tracker_connection(man, req, ios, bind_infc, c)
|
||||
, m_man(man)
|
||||
, m_strand(str)
|
||||
, m_name_lookup(m_strand.io_service())
|
||||
, m_socket(m_strand.io_service())
|
||||
, m_name_lookup(ios)
|
||||
, m_socket(ios)
|
||||
, m_transaction_id(0)
|
||||
, m_connection_id(0)
|
||||
, m_settings(stn)
|
||||
|
@ -94,8 +93,8 @@ namespace libtorrent
|
|||
{
|
||||
udp::resolver::query q(hostname, boost::lexical_cast<std::string>(port));
|
||||
m_name_lookup.async_resolve(q
|
||||
, m_strand.wrap(boost::bind(
|
||||
&udp_tracker_connection::name_lookup, self(), _1, _2)));
|
||||
, boost::bind(
|
||||
&udp_tracker_connection::name_lookup, self(), _1, _2));
|
||||
set_timeout(req.event == tracker_request::stopped
|
||||
? m_settings.stop_tracker_timeout
|
||||
: m_settings.tracker_completion_timeout
|
||||
|
|
27
src/upnp.cpp
27
src/upnp.cpp
|
@ -69,9 +69,8 @@ upnp::upnp(io_service& ios, connection_queue& cc
|
|||
, m_callback(cb)
|
||||
, m_retry_count(0)
|
||||
, m_io_service(ios)
|
||||
, m_strand(ios)
|
||||
, m_socket(ios, udp::endpoint(address_v4::from_string("239.255.255.250"), 1900)
|
||||
, m_strand.wrap(bind(&upnp::on_reply, self(), _1, _2, _3)), false)
|
||||
, bind(&upnp::on_reply, self(), _1, _2, _3), false)
|
||||
, m_broadcast_timer(ios)
|
||||
, m_refresh_timer(ios)
|
||||
, m_disabled(false)
|
||||
|
@ -133,8 +132,8 @@ void upnp::discover_device()
|
|||
|
||||
++m_retry_count;
|
||||
m_broadcast_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
||||
m_broadcast_timer.async_wait(m_strand.wrap(bind(&upnp::resend_request
|
||||
, self(), _1)));
|
||||
m_broadcast_timer.async_wait(bind(&upnp::resend_request
|
||||
, self(), _1));
|
||||
|
||||
#ifdef TORRENT_UPNP_LOGGING
|
||||
m_log << time_now_string()
|
||||
|
@ -217,8 +216,8 @@ void upnp::resend_request(asio::error_code const& e)
|
|||
<< " ==> connecting to " << d.url << std::endl;
|
||||
#endif
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_cc, m_strand.wrap(bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, boost::ref(d)))));
|
||||
, m_cc, bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, boost::ref(d))));
|
||||
d.upnp_connection->get(d.url);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
@ -427,8 +426,8 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
|||
<< " ==> connecting to " << d.url << std::endl;
|
||||
#endif
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_cc, m_strand.wrap(bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, boost::ref(d)))));
|
||||
, m_cc, bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, boost::ref(d))));
|
||||
d.upnp_connection->get(d.url);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
|
@ -525,8 +524,8 @@ void upnp::map_port(rootdevice& d, int i)
|
|||
<< " ==> connecting to " << d.hostname << std::endl;
|
||||
#endif
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_cc, m_strand.wrap(bind(&upnp::on_upnp_map_response, self(), _1, _2
|
||||
, boost::ref(d), i)), true
|
||||
, m_cc, bind(&upnp::on_upnp_map_response, self(), _1, _2
|
||||
, boost::ref(d), i), true
|
||||
, bind(&upnp::create_port_mapping, self(), _1, boost::ref(d), i)));
|
||||
|
||||
d.upnp_connection->start(d.hostname, boost::lexical_cast<std::string>(d.port)
|
||||
|
@ -571,8 +570,8 @@ void upnp::unmap_port(rootdevice& d, int i)
|
|||
<< " ==> connecting to " << d.hostname << std::endl;
|
||||
#endif
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_cc, m_strand.wrap(bind(&upnp::on_upnp_unmap_response, self(), _1, _2
|
||||
, boost::ref(d), i)), true
|
||||
, m_cc, bind(&upnp::on_upnp_unmap_response, self(), _1, _2
|
||||
, boost::ref(d), i), true
|
||||
, bind(&upnp::delete_port_mapping, self(), boost::ref(d), i)));
|
||||
d.upnp_connection->start(d.hostname, boost::lexical_cast<std::string>(d.port)
|
||||
, seconds(10));
|
||||
|
@ -920,7 +919,7 @@ void upnp::on_upnp_map_response(asio::error_code const& e
|
|||
{
|
||||
asio::error_code ec;
|
||||
m_refresh_timer.expires_at(d.mapping[mapping].expires, ec);
|
||||
m_refresh_timer.async_wait(m_strand.wrap(bind(&upnp::on_expire, self(), _1)));
|
||||
m_refresh_timer.async_wait(bind(&upnp::on_expire, self(), _1));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1040,7 +1039,7 @@ void upnp::on_expire(asio::error_code const& e)
|
|||
{
|
||||
asio::error_code ec;
|
||||
m_refresh_timer.expires_at(next_expire, ec);
|
||||
m_refresh_timer.async_wait(m_strand.wrap(bind(&upnp::on_expire, self(), _1)));
|
||||
m_refresh_timer.async_wait(bind(&upnp::on_expire, self(), _1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue