gremlin/src/server/server.cpp

33 lines
602 B
C++
Raw Normal View History

2011-01-14 14:59:18 +01:00
#include "Application.h"
#include <iostream>
2011-01-16 23:02:40 +01:00
#include <csignal>
2011-01-14 14:59:18 +01:00
2018-11-26 13:15:41 +01:00
#include "Config.h"
gln::Application app;
2011-01-16 23:02:40 +01:00
void terminate(int param) {
app.stop();
}
int main(int argc, const char **argv) {
2018-11-26 13:15:41 +01:00
gln::Config config;
config.load(argc, argv);
2011-01-14 14:59:18 +01:00
try {
2011-01-16 23:02:40 +01:00
::signal(SIGTERM, terminate);
2011-01-14 21:09:14 +01:00
app.setMaster(true);
2018-11-26 13:15:41 +01:00
app.initialize(config);
2011-01-14 14:59:18 +01:00
while (app.isRunning())
app.update();
app.shutdown();
return 0;
} catch (const char *str) {
std::cerr << "Exception: " << str << std::endl;
return 1;
} catch (const std::exception &e) {
std::cerr << "Exception: " << e.what() << std::endl;
return 1;
}
}