2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
// ProtoProxy.cpp
|
|
|
|
|
|
|
|
// Implements the main app entrypoint
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "Server.h"
|
2015-03-22 10:00:51 -04:00
|
|
|
#include "../../src/Logger.h"
|
|
|
|
#include "../../src/LoggerListeners.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
2015-03-22 10:00:51 -04:00
|
|
|
// Initialize logging subsystem:
|
|
|
|
cLogger::InitiateMultithreading();
|
2015-06-04 09:13:07 -04:00
|
|
|
auto consoleLogListener = MakeConsoleListener(false);
|
2015-03-22 10:00:51 -04:00
|
|
|
auto fileLogListener = new cFileListener();
|
|
|
|
cLogger::GetInstance().AttachListener(consoleLogListener);
|
|
|
|
cLogger::GetInstance().AttachListener(fileLogListener);
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
int ListenPort = (argc > 1) ? atoi(argv[1]) : 25564;
|
|
|
|
int ConnectPort = (argc > 2) ? atoi(argv[2]) : 25565;
|
2015-03-22 10:00:51 -04:00
|
|
|
printf("Initializing ProtoProxy. Listen port %d, connect port %d.\n", ListenPort, ConnectPort);
|
2013-07-29 07:13:03 -04:00
|
|
|
cServer Server;
|
|
|
|
int res = Server.Init(ListenPort, ConnectPort);
|
|
|
|
if (res != 0)
|
|
|
|
{
|
|
|
|
printf("Server initialization failed: %d", res);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
Server.Run();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|