Merge pull request #472 from arvidn/forward-port-ip-voter-fix-1.1

forward port fix to ip_voter from RC_1_0
This commit is contained in:
Arvid Norberg 2016-02-09 20:24:07 -05:00
commit 0d1f259cac
1 changed files with 7 additions and 3 deletions

View File

@ -49,6 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/thread.hpp" #include "libtorrent/thread.hpp"
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/torrent_info.hpp" #include "libtorrent/torrent_info.hpp"
#include "libtorrent/broadcast_socket.hpp" // for supports_ipv6()
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
@ -88,10 +89,13 @@ void init_rand_address()
address rand_v4() address rand_v4()
{ {
do { address_v4 ret;
do
{
g_addr += 0x3080ca; g_addr += 0x3080ca;
} while (g_addr == 0); ret = address_v4(g_addr);
return address_v4(g_addr); } while (is_any(ret) || is_local(ret) || is_loopback(ret));
return ret;
} }
sha1_hash rand_hash() sha1_hash rand_hash()