forked from premiere/premiere-libtorrent
fixed #109
This commit is contained in:
parent
61f713d24a
commit
6b86e5faa3
|
@ -62,9 +62,10 @@ namespace libtorrent
|
|||
{
|
||||
if (a.is_v6()) return false;
|
||||
address_v4 a4 = a.to_v4();
|
||||
return ((a4.to_ulong() & 0xff000000) == 0x0a000000
|
||||
|| (a4.to_ulong() & 0xfff00000) == 0xac100000
|
||||
|| (a4.to_ulong() & 0xffff0000) == 0xc0a80000);
|
||||
unsigned long ip = htonl(a4.to_ulong());
|
||||
return ((ip & 0xff000000) == 0x0a000000
|
||||
|| (ip & 0xfff00000) == 0xac100000
|
||||
|| (ip & 0xffff0000) == 0xc0a80000);
|
||||
}
|
||||
|
||||
address_v4 guess_local_address(asio::io_service& ios)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "libtorrent/http_tracker_connection.hpp"
|
||||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/xml_parse.hpp"
|
||||
#include "libtorrent/upnp.hpp"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
@ -159,6 +160,13 @@ int test_main()
|
|||
, boost::ref(out4), _1, _2, _3));
|
||||
std::cerr << out4 << std::endl;
|
||||
TEST_CHECK(out4 == "BaPgarbage inside element bracketsSfooFaPgarbage inside element brackets");
|
||||
|
||||
// test network functions
|
||||
|
||||
TEST_CHECK(is_local(address::from_string("192.168.0.1")));
|
||||
TEST_CHECK(is_local(address::from_string("10.1.1.56")));
|
||||
TEST_CHECK(!is_local(address::from_string("14.14.251.63")));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue