Able to accept connection

This commit is contained in:
Julien CLEMENT 2020-05-05 15:59:10 +02:00
parent f512de7313
commit b6c825a877

View File

@ -6,12 +6,27 @@
paxos::EventWatcherRegistry paxos::event_register;
ev_signal sigint_watcher;
static void sigint_cb(struct ev_loop* loop, ev_signal*, int)
{
ev_break(loop, EVBREAK_ALL);
}
int main(int, char **argv)
{
paxos::ServerConfig server_config = paxos::ServerConfig::parse(argv[1]);
ev_signal_init(&sigint_watcher, sigint_cb, SIGINT);
paxos::event_register.get_event_loop().register_sigint_watcher(&sigint_watcher);
paxos::LegislatorFactory::Create(server_config.self_);
for (auto config : server_config.legislators_)
{
paxos::LegislatorFactory::Create(config);
}
paxos::event_register.get_event_loop()();
return 0;
}