Listen socket handles need to be week_ptr so that they can detect when a listen
socket is removed in the middle of a tracker announce on it. Use a wrapper class
to enforce that no one outside of session_impl can hold ownership of the socket
across event boundaries.
To support unit tests, listen_socket_t is also split into a base class which
holds the members needed to support the public listen socket API.
Pointers to listen_socket_t are stored in dht_tracker, so they
cannot be copied or moved once they are added to m_listen_sockets.
listen_socket_t should really be made non-copyable and non-moveable, but the
socket creation path needs to be refactored before that can be done.
We shouldn't listen on addresses which are duplicates, deprecated,
or tenative unless explicitly requested.
This is only supported on Windows for now because the Linux interface
to get this information is much less convenient for libtorrent to use.
As far as I've been able to determine, Linux only exposes this information
via the RTM_NEWADDR and RTM_GETADDR netlink messages. Currently libtorrent
uses getifaddrs() to enumerate network interfaces on Linux so this will
probably need to be changed to use netlink if available.
MacOS: ???
This fixes an assertion failure on shutdown if an IPv6 UTP socket tries
to send a FIN to a closed UDP socket. Because the closed socket reports
its local_endpoint() as udp::endpoint() it trips the protocol check in
send_udp_packet.
This function has been removed from LibreSSL and offers dubious value.
The PRNGs in modern operating systems are robust enough that these little extra
bits arn't going to make a difference.
use unsigned type for file flags. make file_pool private to disk_io_thread. move close_file_interval logic to the disk thread. don't expose file in public interface, and make pool_file_status properly public (not part of file_pool and renamed to open_file_status), this is exposed in public interface via torrent_handle::file_status()