summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-01-14 12:19:35 +0100
committerGravatar default2024-01-14 12:19:35 +0100
commit7ca08aebd245dc7116113bae97e31881fcc09eb0 (patch)
tree206997fd305c5a56cf7456b6090e3dabdcd1c2fb
parentMerge pull request 'Fixed a bug introduced yesterday that caused double notif... (diff)
downloadsnac2-7ca08aebd245dc7116113bae97e31881fcc09eb0.tar.gz
snac2-7ca08aebd245dc7116113bae97e31881fcc09eb0.tar.xz
snac2-7ca08aebd245dc7116113bae97e31881fcc09eb0.zip
Fixed crashes in command-line options.
-rw-r--r--RELEASE_NOTES.md2
-rw-r--r--data.c9
-rw-r--r--snac.h2
3 files changed, 12 insertions, 1 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 6db186c..3b83425 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,6 +4,8 @@
4 4
5Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade. 5Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade.
6 6
7Fixed crashes in some command-line options.
8
7New command-line option `state`, that dumps some information about the running server and the state of each thread. 9New command-line option `state`, that dumps some information about the running server and the state of each thread.
8 10
9Mastodon API: added some fixes for integration with the Mona iOS app (contributed by jamesoff). 11Mastodon API: added some fixes for integration with the Mona iOS app (contributed by jamesoff).
diff --git a/data.c b/data.c
index 97cd94f..b71436e 100644
--- a/data.c
+++ b/data.c
@@ -1508,6 +1508,13 @@ int actor_get(const char *actor, xs_dict **data)
1508 return status; 1508 return status;
1509 } 1509 }
1510 1510
1511 /* if the object is corrupted, discard it */
1512 if (xs_is_null(xs_dict_get(d, "id")) || xs_is_null(xs_dict_get(d, "type"))) {
1513 srv_debug(1, xs_fmt("corrupted actor object %s", actor));
1514 d = xs_free(d);
1515 return 404;
1516 }
1517
1511 if (data) 1518 if (data)
1512 *data = d; 1519 *data = d;
1513 else 1520 else
@@ -2169,7 +2176,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
2169 qmsg = xs_dict_append(qmsg, "seckey", seckey); 2176 qmsg = xs_dict_append(qmsg, "seckey", seckey);
2170 2177
2171 /* if it's to be sent right now, bypass the disk queue and post the job */ 2178 /* if it's to be sent right now, bypass the disk queue and post the job */
2172 if (retries == 0) 2179 if (retries == 0 && p_state != NULL)
2173 job_post(qmsg, 0); 2180 job_post(qmsg, 0);
2174 else { 2181 else {
2175 qmsg = _enqueue_put(fn, qmsg); 2182 qmsg = _enqueue_put(fn, qmsg);
diff --git a/snac.h b/snac.h
index 506257a..326b9f1 100644
--- a/snac.h
+++ b/snac.h
@@ -56,6 +56,8 @@ typedef struct {
56 enum { THST_STOP, THST_WAIT, THST_IN, THST_QUEUE } th_state[MAX_THREADS]; 56 enum { THST_STOP, THST_WAIT, THST_IN, THST_QUEUE } th_state[MAX_THREADS];
57} srv_state; 57} srv_state;
58 58
59extern srv_state *p_state;
60
59void snac_log(snac *user, xs_str *str); 61void snac_log(snac *user, xs_str *str);
60#define snac_debug(user, level, str) do { if (dbglevel >= (level)) \ 62#define snac_debug(user, level, str) do { if (dbglevel >= (level)) \
61 { snac_log((user), (str)); } } while (0) 63 { snac_log((user), (str)); } } while (0)