From d327916c27df7c0becc33fae413f41d4059f8f25 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 1 Oct 2013 04:30:15 +0000 Subject: [PATCH] fix bug in port randomization in unit tests --- test/setup_transfer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 444e9b3cd..e1d7c7838 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -402,15 +402,17 @@ int start_proxy(int proxy_type) { using namespace libtorrent; - std::srand((unsigned int)total_microseconds(time_now() - min_time())); - int port = 5000 + (rand() % 55000); - for (std::map::iterator i = running_proxies.begin() , end(running_proxies.end()); i != end; ++i) { if (i->second.type == proxy_type) return i->first; } + unsigned int seed = total_microseconds(time_now_hires() - min_time()); + printf("random seed: %u\n", seed); + std::srand(seed); + int port = 5000 + (rand() % 55000); + char const* type = ""; char const* auth = ""; char const* cmd = "";