* Finished refactoring command_network.cc.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1152 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-03-23 18:24:18 +00:00
parent 28aabb7874
commit db2b813fc4
7 changed files with 131 additions and 94 deletions
+3 -3
View File
@@ -257,11 +257,11 @@ void
Manager::listen_open() {
// This stuff really should be moved outside of manager, make it
// part of the init script.
if (!rpc::call_command_value("get_port_open"))
if (!rpc::call_command_value("port_open"))
return;
int portFirst, portLast;
torrent::Object portRange = rpc::call_command_void("get_port_range");
torrent::Object portRange = rpc::call_command_void("port_range");
if (portRange.is_string()) {
if (std::sscanf(portRange.as_string().c_str(), "%i-%i", &portFirst, &portLast) != 2)
@@ -276,7 +276,7 @@ Manager::listen_open() {
if (portFirst > portLast || portLast >= (1 << 16))
throw torrent::input_error("Invalid port range.");
if (rpc::call_command_value("get_port_random")) {
if (rpc::call_command_value("port_random")) {
int boundary = portFirst + random() % (portLast - portFirst + 1);
if (torrent::connection_manager()->listen_open(boundary, portLast) ||