summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-08-09 19:36:31 +0200
committerGravatar default2023-08-09 19:36:31 +0200
commit203dd883896c015429a60deaa16726af2402706f (patch)
treea47f468a3353e93580f9218c2bc7e5982e3e4ff5
parentBackport from xs. (diff)
downloadpenes-snac2-203dd883896c015429a60deaa16726af2402706f.tar.gz
penes-snac2-203dd883896c015429a60deaa16726af2402706f.tar.xz
penes-snac2-203dd883896c015429a60deaa16726af2402706f.zip
Be more strict in not retrying on permanent errors.
-rw-r--r--activitypub.c4
-rw-r--r--xs_curl.h9
-rw-r--r--xs_version.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c
index fdccf1c..6c8c484 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1430,8 +1430,8 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
1430 /* bring the actor */ 1430 /* bring the actor */
1431 a_status = actor_request(snac, actor, &actor_o); 1431 a_status = actor_request(snac, actor, &actor_o);
1432 1432
1433 /* if the actor does not explicitly exist, discard */ 1433 /* do not retry permanent failures */
1434 if (a_status == 404 || a_status == 410) { 1434 if (a_status == 404 || a_status == 410 || a_status < 0) {
1435 snac_debug(snac, 1, 1435 snac_debug(snac, 1,
1436 xs_fmt("dropping message due to actor error %s %d", actor, a_status)); 1436 xs_fmt("dropping message due to actor error %s %d", actor, a_status));
1437 1437
diff --git a/xs_curl.h b/xs_curl.h
index 9f9b63b..3caa8b1 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -169,8 +169,13 @@ xs_dict *xs_http_request(const char *method, const char *url,
169 curl_slist_free_all(list); 169 curl_slist_free_all(list);
170 170
171 if (status != NULL) { 171 if (status != NULL) {
172 if (lstatus == 0) 172 if (lstatus == 0) {
173 lstatus = -cc; 173 /* set the timeout error to a fake HTTP status, or propagate as is */
174 if (cc == CURLE_OPERATION_TIMEDOUT)
175 lstatus = 599;
176 else
177 lstatus = -cc;
178 }
174 179
175 *status = (int) lstatus; 180 *status = (int) lstatus;
176 } 181 }
diff --git a/xs_version.h b/xs_version.h
index 7da6c06..1cc950c 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* ac9fa6f1941aa3e701bbb1da50b4d5a07090eddb */ /* 246a8bc9941850f68bf9034662a8a96bcd33926d */