add feature to automatically close client_test after a specified amount of time (for scripting tests)

This commit is contained in:
Arvid Norberg 2010-11-25 23:35:43 +00:00
parent 93702052fb
commit ba5b0638c0
1 changed files with 6 additions and 1 deletions

View File

@ -836,6 +836,8 @@ int main(int argc, char* argv[])
" -W <num peers> Set the max number of peers to keep in the peer list\n"
" -N Do not attempt to use UPnP and NAT-PMP to forward ports\n"
" -Y Rate limit local peers\n"
" -q <num loops> automatically quit the client after <num loops> of refreshes\n"
" this is useful for scripting tests\n"
" "
"\n\n"
"TORRENT is a path to a .torrent file\n"
@ -859,6 +861,7 @@ int main(int argc, char* argv[])
int refresh_delay = 1;
bool start_dht = true;
bool start_upnp = true;
int loop_limit = 0;
std::deque<std::string> events;
@ -1039,6 +1042,7 @@ int main(int argc, char* argv[])
case 'I': outgoing_interface = arg; break;
case 'N': start_upnp = false; --i; break;
case 'Y': settings.ignore_limits_on_local_network = false; --i; break;
case 'q': loop_limit = atoi(arg); break;
}
++i; // skip the argument
}
@ -1134,8 +1138,9 @@ int main(int argc, char* argv[])
std::vector<peer_info> peers;
std::vector<partial_piece_info> queue;
for (;;)
while (loop_limit > 1 || loop_limit == 0)
{
if (loop_limit > 1) --loop_limit;
char c;
while (sleep_and_input(&c, refresh_delay))
{