add feature to automatically close client_test after a specified amount of time (for scripting tests)
This commit is contained in:
@@ -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"
|
" -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"
|
" -N Do not attempt to use UPnP and NAT-PMP to forward ports\n"
|
||||||
" -Y Rate limit local peers\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"
|
"\n\n"
|
||||||
"TORRENT is a path to a .torrent file\n"
|
"TORRENT is a path to a .torrent file\n"
|
||||||
@@ -859,6 +861,7 @@ int main(int argc, char* argv[])
|
|||||||
int refresh_delay = 1;
|
int refresh_delay = 1;
|
||||||
bool start_dht = true;
|
bool start_dht = true;
|
||||||
bool start_upnp = true;
|
bool start_upnp = true;
|
||||||
|
int loop_limit = 0;
|
||||||
|
|
||||||
std::deque<std::string> events;
|
std::deque<std::string> events;
|
||||||
|
|
||||||
@@ -1039,6 +1042,7 @@ int main(int argc, char* argv[])
|
|||||||
case 'I': outgoing_interface = arg; break;
|
case 'I': outgoing_interface = arg; break;
|
||||||
case 'N': start_upnp = false; --i; break;
|
case 'N': start_upnp = false; --i; break;
|
||||||
case 'Y': settings.ignore_limits_on_local_network = 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
|
++i; // skip the argument
|
||||||
}
|
}
|
||||||
@@ -1134,8 +1138,9 @@ int main(int argc, char* argv[])
|
|||||||
std::vector<peer_info> peers;
|
std::vector<peer_info> peers;
|
||||||
std::vector<partial_piece_info> queue;
|
std::vector<partial_piece_info> queue;
|
||||||
|
|
||||||
for (;;)
|
while (loop_limit > 1 || loop_limit == 0)
|
||||||
{
|
{
|
||||||
|
if (loop_limit > 1) --loop_limit;
|
||||||
char c;
|
char c;
|
||||||
while (sleep_and_input(&c, refresh_delay))
|
while (sleep_and_input(&c, refresh_delay))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user