Changeset - c768550b6645
[Not reviewed]
0 1 0
HanzZ - 14 years ago 2011-06-26 17:40:23
hanzz.k@gmail.com
First version of spectrum_manager
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
spectrum_manager/src/main.cpp
Show inline comments
 
@@ -29,59 +29,59 @@ int main(int argc, char **argv)
 
{
 
	ManagerConfig config;
 
 
	boost::program_options::options_description desc("Usage: spectrum_manager <config_file.cfg>\nAllowed options");
 
	desc.add_options()
 
		("help,h", "help")
 
		;
 
	try
 
	{
 
		boost::program_options::variables_map vm;
 
		boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
 
		boost::program_options::notify(vm);
 
		if(vm.count("help"))
 
		{
 
			std::cout << desc << "\n";
 
			return 1;
 
		}
 
	}
 
	catch (std::runtime_error& e)
 
	{
 
		std::cout << desc << "\n";
 
		return 1;
 
	}
 
	catch (...)
 
	{
 
		std::cout << desc << "\n";
 
		return 1;
 
	}
 
 
	if (argc != 2) {
 
		std::cout << desc << "\n";
 
		return 1;
 
	}
 
 
 
	if (!config.load(argv[1])) {
 
		std::cerr << "Can't load configuration file.\n";
 
		return 1;
 
	}
 
 
	Swift::SimpleEventLoop eventLoop;
 
	Swift::BoostNetworkFactories networkFactories(&eventLoop);
 
 
	std::vector<std::string> servers = CONFIG_VECTOR(&config, "servers.server");
 
	for (std::vector<std::string>::const_iterator it = servers.begin(); it != servers.end(); it++) {
 
		finished++;
 
		Swift::Client *client = new Swift::Client(CONFIG_STRING(&config, "service.admin_username") + "@" + (*it), CONFIG_STRING(&config, "service.admin_password"), &networkFactories);
 
		client->setAlwaysTrustCertificates();
 
// 		client->onConnected.connect(bind(&handleConnected, client));
 
 		client->onConnected.connect(boost::bind(&handleConnected, client));
 
		client->onDisconnected.connect(bind(&handleDisconnected, client, _1));
 
// 		client->onMessageReceived.connect(bind(&handleMessageReceived, _1));
 
		Swift::ClientOptions opt;
 
		opt.allowPLAINWithoutTLS = true;
 
		client->connect(opt);
 
// 		std::cout << *it << "\n";
 
	}
 
 
	eventLoop.run();
 
}
0 comments (0 inline, 0 general)