fixed race condition in enum_net
This commit is contained in:
parent
a26bd55ff9
commit
87c079033d
|
@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
std::vector<address> const& enum_net_interfaces(asio::io_service& ios, asio::error_code& ec);
|
std::vector<address> enum_net_interfaces(asio::io_service& ios, asio::error_code& ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,10 +40,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
std::vector<address> const& enum_net_interfaces(asio::io_service& ios, asio::error_code& ec)
|
std::vector<address> enum_net_interfaces(asio::io_service& ios, asio::error_code& ec)
|
||||||
{
|
{
|
||||||
static std::vector<address> ret;
|
std::vector<address> ret;
|
||||||
if (!ret.empty()) return ret;
|
|
||||||
|
|
||||||
#if defined __linux__ || defined __MACH__ || defined(__FreeBSD__)
|
#if defined __linux__ || defined __MACH__ || defined(__FreeBSD__)
|
||||||
int s = socket(AF_INET, SOCK_DGRAM, 0);
|
int s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
Loading…
Reference in New Issue