This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/src/core/main.cpp

54 lines
1.1 KiB
C++
Raw Normal View History

#include <stdio.h>
#include <stddef.h>
#include <signal.h>
#include "stellar/stellar.h"
#include "stellar_core.h"
struct stellar *st = NULL;
static void signal_handler(int signo)
{
if (signo == SIGINT)
{
printf("SIGINT received, notify threads to exit\n");
stellar_loopbreak(st);
}
if (signo == SIGQUIT)
{
printf("SIGQUIT received, notify threads to exit\n");
stellar_loopbreak(st);
}
if (signo == SIGTERM)
{
printf("SIGTERM received, notify threads to exit\n");
stellar_loopbreak(st);
}
if (signo == SIGHUP)
{
printf("SIGHUP received, reload log level\n");
stellar_reload_log_level(st);
}
}
int main(int argc __attribute__((__unused__)), char **argv __attribute__((__unused__)))
{
signal(SIGINT, signal_handler);
signal(SIGQUIT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGHUP, signal_handler);
st = stellar_new("./conf/stellar.toml", "./plugin/spec.toml", "./conf/log.toml");
if (st == NULL)
{
return 0;
}
stellar_run(st);
stellar_free(st);
return 0;
}