Split websocket connections to two ports.

This commit is contained in:
Arthur Britto
2012-11-05 14:18:34 -08:00
parent 4dfaaf078d
commit bd458fd450
9 changed files with 79 additions and 35 deletions

View File

@@ -148,7 +148,7 @@ void Application::run()
}
else
{
std::cerr << "Peer interface: disabled" << std::endl;
cLog(lsINFO) << "Peer interface: disabled";
}
//
@@ -160,10 +160,32 @@ void Application::run()
}
else
{
std::cerr << "RPC interface: disabled" << std::endl;
cLog(lsINFO) << "RPC interface: disabled";
}
mWSDoor = WSDoor::createWSDoor();
//
// Allow private WS connections.
//
if (!theConfig.WEBSOCKET_IP.empty() && theConfig.WEBSOCKET_PORT)
{
mWSPrivateDoor = WSDoor::createWSDoor(theConfig.WEBSOCKET_IP, theConfig.WEBSOCKET_PORT, false);
}
else
{
cLog(lsINFO) << "WS private interface: disabled";
}
//
// Allow public WS connections.
//
if (!theConfig.WEBSOCKET_PUBLIC_IP.empty() && theConfig.WEBSOCKET_PUBLIC_PORT)
{
mWSPublicDoor = WSDoor::createWSDoor(theConfig.WEBSOCKET_PUBLIC_IP, theConfig.WEBSOCKET_PUBLIC_PORT, true);
}
else
{
cLog(lsINFO) << "WS public interface: disabled";
}
//
// Begin connecting to network.
@@ -182,9 +204,13 @@ void Application::run()
mIOService.run(); // This blocks
mWSDoor->stop();
if (mWSPublicDoor)
mWSPublicDoor->stop();
std::cout << "Done." << std::endl;
if (mWSPrivateDoor)
mWSPrivateDoor->stop();
cLog(lsINFO) << "Done.";
}
void Application::sweep()