From fbac9f785adbf48c3747f09c31bd6cb3b09f68a7 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 18 Sep 2007 01:25:28 +0000 Subject: [PATCH] disabled loopback for upnp --- include/libtorrent/broadcast_socket.hpp | 2 +- src/broadcast_socket.cpp | 5 +++-- src/upnp.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/libtorrent/broadcast_socket.hpp b/include/libtorrent/broadcast_socket.hpp index b7285ee9c..23507e402 100644 --- a/include/libtorrent/broadcast_socket.hpp +++ b/include/libtorrent/broadcast_socket.hpp @@ -51,7 +51,7 @@ namespace libtorrent { public: broadcast_socket(asio::io_service& ios, udp::endpoint const& multicast_endpoint - , receive_handler_t const& handler); + , receive_handler_t const& handler, bool loopback = true); ~broadcast_socket() { close(); } void send(char const* buffer, int size, asio::error_code& ec); diff --git a/src/broadcast_socket.cpp b/src/broadcast_socket.cpp index 85bd829dc..9355ffc95 100644 --- a/src/broadcast_socket.cpp +++ b/src/broadcast_socket.cpp @@ -69,7 +69,8 @@ namespace libtorrent broadcast_socket::broadcast_socket(asio::io_service& ios , udp::endpoint const& multicast_endpoint - , receive_handler_t const& handler) + , receive_handler_t const& handler + , bool loopback) : m_multicast_endpoint(multicast_endpoint) , m_on_receive(handler) { @@ -102,7 +103,7 @@ namespace libtorrent if (ec) continue; s->set_option(hops(255), ec); if (ec) continue; - s->set_option(enable_loopback(true), ec); + s->set_option(enable_loopback(loopback), ec); if (ec) continue; m_sockets.push_back(socket_entry(s)); socket_entry& se = m_sockets.back(); diff --git a/src/upnp.cpp b/src/upnp.cpp index 417521c19..ad50595a2 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -70,7 +70,7 @@ upnp::upnp(io_service& ios, connection_queue& cc , 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, this, _1, _2, _3))) + , m_strand.wrap(bind(&upnp::on_reply, this, _1, _2, _3)), false) , m_broadcast_timer(ios) , m_refresh_timer(ios) , m_disabled(false)