add a flag to client_test to turn off upnp and nat-pmp

This commit is contained in:
Arvid Norberg 2010-08-03 07:30:38 +00:00
parent 9d56f3f459
commit e7561e5274
1 changed files with 11 additions and 5 deletions

View File

@ -778,6 +778,7 @@ int main(int argc, char* argv[])
" proxy specified by -P\n"
" -H Don't start DHT\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\n"
"TORRENT is a path to a .torrent file\n"
@ -800,6 +801,7 @@ int main(int argc, char* argv[])
int refresh_delay = 1;
bool start_dht = true;
bool start_upnp = true;
std::deque<std::string> events;
@ -826,10 +828,6 @@ int main(int argc, char* argv[])
ses.load_state(e);
}
ses.start_lsd();
ses.start_upnp();
ses.start_natpmp();
#ifndef TORRENT_DISABLE_GEO_IP
ses.load_asnum_db("GeoIPASNum.dat");
ses.load_country_db("GeoIP.dat");
@ -944,7 +942,7 @@ int main(int argc, char* argv[])
case 'O': settings.allow_reordered_disk_operations = false; --i; break;
case 'P':
{
char* port = (char*) strchr(arg, ':');
char* port = (char*) strrchr(arg, ':');
if (port == 0)
{
fprintf(stderr, "invalid proxy hostname, no port found\n");
@ -976,10 +974,18 @@ int main(int argc, char* argv[])
}
break;
case 'I': outgoing_interface = arg; break;
case 'N': start_upnp = false; --i; break;
}
++i; // skip the argument
}
ses.start_lsd();
if (start_upnp)
{
ses.start_upnp();
ses.start_natpmp();
}
ses.set_peer_proxy(ps);
ses.set_web_seed_proxy(ps);
ses.set_tracker_proxy(ps);