Fix a TODO in network_ana.cpp.

The queue_disconnect invocation should hold the same logic as a
standard disconnect in the current implementation (after reading
comments for queue_disconnect in network.hpp.) I also added some
command line options to game.cpp (commented at the moment) that will
help implement support for connection trhough proxy.
This commit is contained in:
Guillermo Biset 2010-09-22 18:49:11 +00:00
parent 81b1fa606d
commit 773b3bf38f
3 changed files with 42 additions and 4 deletions

View file

@ -147,7 +147,7 @@ class ChatServer : public listener_handler,
handle_disconnect(error, client);
}
server* server_;
server* server_;
std::map<net_id, std::string> names_;
};

View file

@ -457,7 +457,45 @@ game_controller::game_controller(int argc, char** argv) :
// the work-in-progress new storyscreen code.
// Don't document.
set_new_storyscreen(true);
} else if(val == "--new-widgets") {
} /* //These commented lines should be used to implement support of connection
//through a proxy via command line options.
//The ANA network module should implement these methods (while the SDL_net won't.)
else if(val == "--proxy") {
network::enable_connection_through_proxy();
} else if(val == "--proxy-address") {
if ( argv_[ arg_ + 1][0] != '-')
{
network::enable_connection_through_proxy();
network::set_proxy_address( argv_[ ++arg_ ] );
}
else
throw std::runtime_error("Proxy address option requires address");
} else if(val == "--proxy-port") {
if ( argv_[ arg_ + 1][0] != '-')
{
network::enable_connection_through_proxy();
network::set_proxy_port( argv_[ ++arg_ ] );
}
else
throw std::runtime_error("Proxy port option requires port");
} else if(val == "--proxy-user") {
if ( argv_[ arg_ + 1][0] != '-')
{
network::enable_connection_through_proxy();
network::set_proxy_user( argv_[ ++arg_ ] );
}
else
throw std::runtime_error("Proxy user option requires user name");
} else if(val == "--proxy-password") {
if ( argv_[ arg_ + 1][0] != '-')
{
network::enable_connection_through_proxy();
network::set_proxy_port( argv_[ ++arg_ ] );
}
else
throw std::runtime_error("Proxy password option requires password");
} */else if(val == "--new-widgets") {
// This is a hidden option to enable the new widget toolkit.
gui2::new_widgets = true;
#ifndef DISABLE_EDITOR

View file

@ -190,9 +190,9 @@ namespace network {
return ana_manager.disconnect( handle );
}
void queue_disconnect(network::connection /*sock*/)
void queue_disconnect(network::connection handle )
{
throw("TODO:Not implemented queue_disconnect");
ana_manager.disconnect( handle );
}
connection receive_data(config& cfg,