v0.2.4 - Fix SIGINT handling so Ctrl-C exits didactyl reliably
This commit is contained in:
@@ -54,11 +54,11 @@ Skills compose by adoption-list order (`10123`) and trigger tags carry runtime e
|
||||
|
||||
Didactyl will support local inference, which is very privacy preserving. Remote inference does however have it's advantages, and in those cases Didactyl supports using Bitcoin Lightning and eCash inference providers.
|
||||
|
||||
## Current Status — v0.2.3
|
||||
## Current Status — v0.2.4
|
||||
|
||||
**Active build — this project is barely working. Experiment at your own risk.**
|
||||
|
||||
> Last release update: v0.2.3 — Silence unused static helper warnings after migration rollback reapply
|
||||
> Last release update: v0.2.4 — Fix SIGINT handling so Ctrl-C exits didactyl reliably
|
||||
|
||||
- Connects to configured relays with auto-reconnect and relay state transition logging
|
||||
- Publishes configured startup events per relay as each relay becomes connected
|
||||
|
||||
27
src/main.c
27
src/main.c
@@ -56,8 +56,15 @@ static void on_self_skill_eose_load_triggers(int event_count, void* user_data) {
|
||||
}
|
||||
}
|
||||
|
||||
static volatile sig_atomic_t g_sigint_count = 0;
|
||||
|
||||
static void signal_handler(int signum) {
|
||||
(void)signum;
|
||||
if (signum == SIGINT) {
|
||||
g_sigint_count++;
|
||||
if (g_sigint_count >= 2) {
|
||||
_exit(130);
|
||||
}
|
||||
}
|
||||
g_running = 0;
|
||||
}
|
||||
|
||||
@@ -1442,9 +1449,21 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
struct sigaction sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = signal_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
|
||||
(void)sigaction(SIGINT, &sa, NULL);
|
||||
(void)sigaction(SIGTERM, &sa, NULL);
|
||||
|
||||
struct sigaction sa_pipe;
|
||||
memset(&sa_pipe, 0, sizeof(sa_pipe));
|
||||
sa_pipe.sa_handler = SIG_IGN;
|
||||
sigemptyset(&sa_pipe.sa_mask);
|
||||
sa_pipe.sa_flags = 0;
|
||||
(void)sigaction(SIGPIPE, &sa_pipe, NULL);
|
||||
|
||||
int http_api_started = 0;
|
||||
if (cfg.api.enabled) {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
// Using DIDACTYL_ prefix to avoid conflicts with nostr_core_lib VERSION macros
|
||||
#define DIDACTYL_VERSION_MAJOR 0
|
||||
#define DIDACTYL_VERSION_MINOR 2
|
||||
#define DIDACTYL_VERSION_PATCH 3
|
||||
#define DIDACTYL_VERSION "v0.2.3"
|
||||
#define DIDACTYL_VERSION_PATCH 4
|
||||
#define DIDACTYL_VERSION "v0.2.4"
|
||||
|
||||
// Agent metadata
|
||||
#define DIDACTYL_NAME "Didactyl"
|
||||
|
||||
Reference in New Issue
Block a user