commit bfdaf38

default  ·  2023-12-11 09:41:41 +0000 UTC
parent c06b74c
More logging tweaks.
2 files changed,  +12, -8
M data.c
+4, -4
 1@@ -118,7 +118,7 @@ int activitypub_request(snac *user, const char *url, xs_dict **data)
 2 int actor_request(const char *actor, xs_dict **data)
 3 /* request an actor */
 4 {
 5-    int status, status2;
 6+    int status;
 7     xs *payload = NULL;
 8 
 9     if (data)
10@@ -129,9 +129,9 @@ int actor_request(const char *actor, xs_dict **data)
11 
12     if (status != 200) {
13         /* actor data non-existent or stale: get from the net */
14-        status2 = activitypub_request(NULL, actor, &payload);
15+        status = activitypub_request(NULL, actor, &payload);
16 
17-        if (valid_status(status2)) {
18+        if (valid_status(status)) {
19             /* renew data */
20             status = actor_add(actor, payload);
21 
22@@ -141,7 +141,7 @@ int actor_request(const char *actor, xs_dict **data)
23             }
24         }
25         else
26-            srv_debug(0, xs_fmt("actor_request error %d", status2));
27+            srv_debug(0, xs_fmt("actor_request error %s %d", actor, status));
28     }
29 
30     /* collect the (presumed) shared inbox in this actor */
M data.c
+8, -4
 1@@ -649,10 +649,14 @@ int _object_add(const char *id, const xs_dict *obj, int ow)
 2     xs *fn     = _object_fn(id);
 3     FILE *f;
 4 
 5-    if (!ow && mtime(fn) > 0.0) {
 6-        /* object already here */
 7-        srv_debug(1, xs_fmt("object_add object already here %s", id));
 8-        return 204; /* No content */
 9+    if (mtime(fn) > 0.0) {
10+        if (!ow) {
11+            /* object already here */
12+            srv_debug(1, xs_fmt("object_add object already here %s", id));
13+            return 204; /* No content */
14+        }
15+        else
16+            status = 200;
17     }
18 
19     if ((f = fopen(fn, "w")) != NULL) {