Files
cuberite-2a/Tools/ProtoProxy/ProtoProxy.cpp
T

49 lines
1.1 KiB
C++
Raw Normal View History

2013-07-29 12:13:03 +01:00
// ProtoProxy.cpp
// Implements the main app entrypoint
#include "Globals.h"
#include "Server.h"
2015-03-22 15:00:51 +01:00
#include "../../src/Logger.h"
#include "../../src/LoggerListeners.h"
2013-07-29 12:13:03 +01:00
int main(int argc, char ** argv)
{
2015-03-22 15:00:51 +01:00
// Initialize logging subsystem:
2015-06-04 14:13:07 +01:00
auto consoleLogListener = MakeConsoleListener(false);
auto consoleAttachment = cLogger::GetInstance().AttachListener(std::move(consoleLogListener));
auto fileLogListenerRet = MakeFileListener();
if (!fileLogListenerRet.first)
{
LOGERROR("Failed to open log file, aborting");
return EXIT_FAILURE;
}
auto fileAttachment = cLogger::GetInstance().AttachListener(std::move(fileLogListenerRet.second));
cLogger::InitiateMultithreading();
2015-03-22 15:00:51 +01:00
2013-07-29 12:13:03 +01:00
int ListenPort = (argc > 1) ? atoi(argv[1]) : 25564;
int ConnectPort = (argc > 2) ? atoi(argv[2]) : 25565;
2015-03-22 15:00:51 +01:00
printf("Initializing ProtoProxy. Listen port %d, connect port %d.\n", ListenPort, ConnectPort);
2013-07-29 12:13:03 +01:00
cServer Server;
int res = Server.Init(ListenPort, ConnectPort);
if (res != 0)
{
printf("Server initialization failed: %d", res);
return res;
}
Server.Run();
return 0;
}