commit 7ca08ae

default  ·  2024-01-14 11:19:35 +0000 UTC
parent d021162
Fixed crashes in command-line options.
3 files changed,  +12, -1
M data.c
M snac.h
+2, -0
1@@ -4,6 +4,8 @@
2 
3 Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade.
4 
5+Fixed crashes in some command-line options.
6+
7 New command-line option `state`, that dumps some information about the running server and the state of each thread.
8 
9 Mastodon API: added some fixes for integration with the Mona iOS app (contributed by jamesoff).
M data.c
+8, -1
 1@@ -1508,6 +1508,13 @@ int actor_get(const char *actor, xs_dict **data)
 2         return status;
 3     }
 4 
 5+    /* if the object is corrupted, discard it */
 6+    if (xs_is_null(xs_dict_get(d, "id")) || xs_is_null(xs_dict_get(d, "type"))) {
 7+        srv_debug(1, xs_fmt("corrupted actor object %s", actor));
 8+        d = xs_free(d);
 9+        return 404;
10+    }
11+
12     if (data)
13         *data = d;
14     else
15@@ -2169,7 +2176,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
16     qmsg = xs_dict_append(qmsg, "seckey", seckey);
17 
18     /* if it's to be sent right now, bypass the disk queue and post the job */
19-    if (retries == 0)
20+    if (retries == 0 && p_state != NULL)
21         job_post(qmsg, 0);
22     else {
23         qmsg = _enqueue_put(fn, qmsg);
M snac.h
+2, -0
1@@ -56,6 +56,8 @@ typedef struct {
2     enum { THST_STOP, THST_WAIT, THST_IN, THST_QUEUE } th_state[MAX_THREADS];
3 } srv_state;
4 
5+extern srv_state *p_state;
6+
7 void snac_log(snac *user, xs_str *str);
8 #define snac_debug(user, level, str) do { if (dbglevel >= (level)) \
9     { snac_log((user), (str)); } } while (0)