Able to accept connection
This commit is contained in:
parent
f512de7313
commit
b6c825a877
15
src/main.cc
15
src/main.cc
@ -6,12 +6,27 @@
|
|||||||
|
|
||||||
paxos::EventWatcherRegistry paxos::event_register;
|
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)
|
int main(int, char **argv)
|
||||||
{
|
{
|
||||||
paxos::ServerConfig server_config = paxos::ServerConfig::parse(argv[1]);
|
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_)
|
for (auto config : server_config.legislators_)
|
||||||
{
|
{
|
||||||
paxos::LegislatorFactory::Create(config);
|
paxos::LegislatorFactory::Create(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paxos::event_register.get_event_loop()();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user