mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-03 14:26:09 +00:00
begin rewrite: add lionkor/commandline
This commit is contained in:
committed by
Anonymous275
parent
6a2ce7faab
commit
e5e447c7af
50
src/main.cpp
50
src/main.cpp
@@ -1,50 +1,12 @@
|
||||
#include "CustomAssert.h"
|
||||
|
||||
#include "Settings.h"
|
||||
#include "Startup.h"
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#ifndef WIN32
|
||||
#include <csignal>
|
||||
void UnixSignalHandler(int sig) {
|
||||
switch (sig) {
|
||||
case SIGPIPE:
|
||||
warn(("ignored signal SIGPIPE: Pipe broken"));
|
||||
break;
|
||||
default:
|
||||
error(("Signal arrived in handler but was not handled: ") + std::to_string(sig));
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
[[noreturn]] void loop() {
|
||||
DebugPrintTID();
|
||||
#include "TConsole.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
TConsole Console;
|
||||
while (true) {
|
||||
std::cout.flush();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(600));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
#ifndef WIN32
|
||||
// ignore SIGPIPE, the signal that is sent for example when a client
|
||||
// disconnects while data is being sent to him ("broken pipe").
|
||||
signal(SIGPIPE, UnixSignalHandler);
|
||||
#endif // WIN32
|
||||
DebugPrintTID();
|
||||
#ifdef DEBUG
|
||||
std::thread t1(loop);
|
||||
t1.detach();
|
||||
#endif
|
||||
StartTime = std::chrono::high_resolution_clock::now();
|
||||
ConsoleInit();
|
||||
InitServer(argc, argv);
|
||||
InitConfig();
|
||||
InitLua();
|
||||
InitRes();
|
||||
HBInit();
|
||||
StatInit();
|
||||
NetMain();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user