forked from premiere/premiere-libtorrent
moved initialization of multicast addresses from global initializers to local constructors to avoid WSAStartup issues on windows
This commit is contained in:
parent
675781d604
commit
c7b4f49d5a
|
@ -65,6 +65,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static address_v4 lsd_multicast_address;
|
||||||
|
static udp::endpoint lsd_multicast_endpoint;
|
||||||
|
|
||||||
void resend_announce(asio::error_code const& e, std::string msg);
|
void resend_announce(asio::error_code const& e, std::string msg);
|
||||||
void on_announce(asio::error_code const& e
|
void on_announce(asio::error_code const& e
|
||||||
, std::size_t bytes_transferred);
|
, std::size_t bytes_transferred);
|
||||||
|
|
|
@ -72,6 +72,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static address_v4 upnp_multicast_address;
|
||||||
|
static udp::endpoint upnp_multicast_endpoint;
|
||||||
|
|
||||||
enum { num_mappings = 2 };
|
enum { num_mappings = 2 };
|
||||||
enum { default_lease_time = 3600 };
|
enum { default_lease_time = 3600 };
|
||||||
|
|
||||||
|
|
12
src/lsd.cpp
12
src/lsd.cpp
|
@ -46,12 +46,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
using boost::bind;
|
using boost::bind;
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
namespace
|
address_v4 lsd::lsd_multicast_address;
|
||||||
{
|
udp::endpoint lsd::lsd_multicast_endpoint;
|
||||||
// Bittorrent Local discovery multicast address and port
|
|
||||||
address_v4 lsd_multicast_address = address_v4::from_string("239.192.152.143");
|
|
||||||
udp::endpoint lsd_multicast_endpoint(lsd_multicast_address, 6771);
|
|
||||||
}
|
|
||||||
|
|
||||||
lsd::lsd(io_service& ios, address const& listen_interface
|
lsd::lsd(io_service& ios, address const& listen_interface
|
||||||
, peer_callback_t const& cb)
|
, peer_callback_t const& cb)
|
||||||
|
@ -61,6 +57,10 @@ lsd::lsd(io_service& ios, address const& listen_interface
|
||||||
, m_broadcast_timer(ios)
|
, m_broadcast_timer(ios)
|
||||||
, m_disabled(false)
|
, m_disabled(false)
|
||||||
{
|
{
|
||||||
|
// Bittorrent Local discovery multicast address and port
|
||||||
|
lsd_multicast_address = address_v4::from_string("239.192.152.143");
|
||||||
|
lsd_multicast_endpoint = udp::endpoint(lsd_multicast_address, 6771);
|
||||||
|
|
||||||
#if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING)
|
#if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING)
|
||||||
m_log.open("lsd.log", std::ios::in | std::ios::out | std::ios::trunc);
|
m_log.open("lsd.log", std::ios::in | std::ios::out | std::ios::trunc);
|
||||||
#endif
|
#endif
|
||||||
|
|
12
src/upnp.cpp
12
src/upnp.cpp
|
@ -47,12 +47,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
using boost::bind;
|
using boost::bind;
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
namespace
|
address_v4 upnp::upnp_multicast_address;
|
||||||
{
|
udp::endpoint upnp::upnp_multicast_endpoint;
|
||||||
// UPnP multicast address and port
|
|
||||||
address_v4 upnp_multicast_address = address_v4::from_string("239.255.255.250");
|
|
||||||
udp::endpoint upnp_multicast_endpoint(upnp_multicast_address, 1900);
|
|
||||||
}
|
|
||||||
|
|
||||||
upnp::upnp(io_service& ios, address const& listen_interface
|
upnp::upnp(io_service& ios, address const& listen_interface
|
||||||
, std::string const& user_agent, portmap_callback_t const& cb)
|
, std::string const& user_agent, portmap_callback_t const& cb)
|
||||||
|
@ -68,6 +64,10 @@ upnp::upnp(io_service& ios, address const& listen_interface
|
||||||
, m_disabled(false)
|
, m_disabled(false)
|
||||||
, m_closing(false)
|
, m_closing(false)
|
||||||
{
|
{
|
||||||
|
// UPnP multicast address and port
|
||||||
|
upnp_multicast_address = address_v4::from_string("239.255.255.250");
|
||||||
|
upnp_multicast_endpoint = udp::endpoint(upnp_multicast_address, 1900);
|
||||||
|
|
||||||
#ifdef TORRENT_UPNP_LOGGING
|
#ifdef TORRENT_UPNP_LOGGING
|
||||||
m_log.open("upnp.log", std::ios::in | std::ios::out | std::ios::trunc);
|
m_log.open("upnp.log", std::ios::in | std::ios::out | std::ios::trunc);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue