diff --git a/include/libtorrent/broadcast_socket.hpp b/include/libtorrent/broadcast_socket.hpp index 540455b14..7d6d45d02 100644 --- a/include/libtorrent/broadcast_socket.hpp +++ b/include/libtorrent/broadcast_socket.hpp @@ -79,10 +79,10 @@ namespace libtorrent { struct socket_entry { - explicit socket_entry(std::shared_ptr const& s) - : socket(s), broadcast(false) { std::memset(buffer, 0, sizeof(buffer)); } - socket_entry(std::shared_ptr const& s - , address_v4 const& mask): socket(s), netmask(mask), broadcast(false) + explicit socket_entry(std::shared_ptr s) + : socket(std::move(s)), broadcast(false) { std::memset(buffer, 0, sizeof(buffer)); } + socket_entry(std::shared_ptr s + , address_v4 const& mask): socket(std::move(s)), netmask(mask), broadcast(false) { std::memset(buffer, 0, sizeof(buffer)); } std::shared_ptr socket; char buffer[1500]; diff --git a/src/broadcast_socket.cpp b/src/broadcast_socket.cpp index 57e4f30b1..a9eff0619 100644 --- a/src/broadcast_socket.cpp +++ b/src/broadcast_socket.cpp @@ -33,17 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" - -#if defined TORRENT_OS2 -#include -#endif - #include - -#ifdef TORRENT_WINDOWS -#include // for if_nametoindex -#endif - #include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/socket.hpp" @@ -129,9 +119,9 @@ namespace libtorrent { #if TORRENT_USE_IPV6 TORRENT_TRY { if (!addr.is_v6()) return false; - std::uint8_t teredo_prefix[] = {0x20, 0x01, 0, 0}; + static const std::uint8_t teredo_prefix[] = {0x20, 0x01, 0, 0}; address_v6::bytes_type b = addr.to_v6().to_bytes(); - return std::memcmp(&b[0], teredo_prefix, 4) == 0; + return std::memcmp(b.data(), teredo_prefix, 4) == 0; } TORRENT_CATCH(std::exception const&) { return false; } #else TORRENT_UNUSED(addr); @@ -189,7 +179,7 @@ namespace libtorrent { std::vector interfaces = enum_net_interfaces(ios, ec); #if TORRENT_USE_IPV6 - if (m_multicast_endpoint.address().is_v6()) + if (m_multicast_endpoint.protocol() == udp::v6()) open_multicast_socket(ios, address_v6::any(), loopback, ec); else #endif