[MOD] Clarify a bit of licensing

This commit is contained in:
LDA 2024-08-13 20:57:41 +02:00
commit ccecc2d435
3 changed files with 26 additions and 49 deletions

View file

@ -1,8 +1,8 @@
For the files src/XML/*, tools/*, src/include/XML.h, and Makefile, see COPYING.CC0 For the files src/XML/*, tools/*, src/include/XML.h, etc/*, and Makefile, see COPYING.CC0
For the file src/Signal.c, it is based on Telodendria, which requires COPYING.TELO
to be present. to be present.
For any other file in src/, see COPYING.AGPL as the primary license. For any other file in src/, see COPYING.AGPL as the primary license.
As Parsee depends on Cytoplasm, its license is left here in COPYING.CYTO
COPYING.CC0 and COPYING.TELO are NOT the primary licenses. COPYING.TELO is present COPYING.CC0 and COPYING.TELO are NOT the primary licenses. COPYING.TELO is present
because of the terms of the Telodendria license, which some of its code is derived because of the terms of the Telodendria licence, used by Cytoplasm, and COPYING.CC0 ONLY applies to the XML parser code.
in src/Signal.c, and COPYING.CC0 ONLY applies to the XML parser code.

View file

@ -8,69 +8,46 @@
static HttpServer *server = NULL; static HttpServer *server = NULL;
static pthread_t xmpp_thr; static pthread_t xmpp_thr;
static bool valid = true;
static XMPPComponent *jabber = NULL; static XMPPComponent *jabber = NULL;
static void static void
SignalHandler(int signal) SignalHandler(int signal)
{ {
switch (signal) if (server && (signal == SIGTERM || signal == SIGINT))
{ {
case SIGPIPE: if (!server)
{
return; return;
case SIGUSR1: }
/* TODO: Soft-restart everything */
return;
case SIGTERM:
case SIGINT:
if (!server)
{
return;
}
/* TODO: Better way to break out. */ /* TODO: Better way to break out. */
Log(LOG_INFO, "Killing thread..."); Log(LOG_INFO, "Killing thread...");
XMPPFinishCompStream(jabber); XMPPFinishCompStream(jabber);
pthread_join(xmpp_thr, NULL); pthread_join(xmpp_thr, NULL);
valid = false; Log(LOG_INFO, "Stopping server...");
Log(LOG_INFO, "Stopping server..."); HttpServerStop(server);
HttpServerStop(server); return;
break;
} }
} }
bool bool
ParseeInitialiseSignals(HttpServer *s, pthread_t xmpp, XMPPComponent *j) ParseeInitialiseSignals(HttpServer *s, pthread_t xmpp, XMPPComponent *j)
{ {
struct sigaction sigAction; struct sigaction sa;
bool ret = true;
server = s; server = s;
xmpp_thr = xmpp; xmpp_thr = xmpp;
jabber = j; jabber = j;
valid = true; sigfillset(&sa.sa_mask);
sa.sa_handler = SignalHandler;
sa.sa_flags = SA_RESTART;
sigAction.sa_handler = SignalHandler; #define Register(act) (sigaction(act, &sa, NULL) >= 0)
sigfillset(&sigAction.sa_mask); if (!Register(SIGTERM) || !Register(SIGINT))
sigAction.sa_flags = SA_RESTART; {
return false;
#define SIGACTION(sig, act, oact) \
if (sigaction(sig, act, oact) < 0) \
{ \
Log(LOG_ERR, "Unable to install signal handler: %s", #sig); \
ret = false; \
} \
else \
{ \
Log(LOG_DEBUG, "Installed signal handler: %s", #sig); \
} }
#undef Register
SIGACTION(SIGINT, &sigAction, NULL); return true;
SIGACTION(SIGTERM, &sigAction, NULL);
SIGACTION(SIGPIPE, &sigAction, NULL);
SIGACTION(SIGUSR1, &sigAction, NULL); /* Make USR1 do a softrestart */
#undef SIGACTION
return ret;
} }