fix bug in port randomization in unit tests

This commit is contained in:
Arvid Norberg 2013-10-01 04:30:15 +00:00
parent 53a95fbcc1
commit d327916c27
1 changed files with 5 additions and 3 deletions

View File

@ -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<int, proxy_t>::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 = "";