forward-port supports_ipv6() fix for linux from RC_1_0 (and fix bug in it)

This commit is contained in:
arvidn 2015-09-06 20:53:06 -04:00
parent 179136c246
commit 9cb4e3d1ca
1 changed files with 8 additions and 0 deletions

View File

@ -148,11 +148,19 @@ namespace libtorrent
bool supports_ipv6()
{
#if TORRENT_USE_IPV6
#ifdef TORRENT_WINDOWS
TORRENT_TRY {
error_code ec;
address::from_string("::1", ec);
return !ec;
} TORRENT_CATCH(std::exception&) { return false; }
#else
io_service ios;
tcp::socket test(ios);
error_code ec;
test.open(tcp::v6(), ec);
return !bool(ec);
#endif // WINDOWS
#else
return false;
#endif