diff options
| -rw-r--r-- | activitypub.c | 4 | ||||
| -rw-r--r-- | data.c | 6 | ||||
| -rw-r--r-- | httpd.c | 29 | ||||
| -rw-r--r-- | xs.h | 21 | ||||
| -rw-r--r-- | xs_version.h | 2 |
5 files changed, 39 insertions, 23 deletions
diff --git a/activitypub.c b/activitypub.c index a0b33ee..0ee0bf6 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -123,7 +123,7 @@ int send_to_inbox(snac *snac, char *inbox, char *msg, d_char **payload, int *p_s | |||
| 123 | response = http_signed_request(snac, "POST", inbox, | 123 | response = http_signed_request(snac, "POST", inbox, |
| 124 | NULL, j_msg, strlen(j_msg), &status, payload, p_size); | 124 | NULL, j_msg, strlen(j_msg), &status, payload, p_size); |
| 125 | 125 | ||
| 126 | free(response); | 126 | xs_free(response); |
| 127 | 127 | ||
| 128 | return status; | 128 | return status; |
| 129 | } | 129 | } |
| @@ -553,7 +553,7 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char | |||
| 553 | 553 | ||
| 554 | /* if this message is public, ours will also be */ | 554 | /* if this message is public, ours will also be */ |
| 555 | if (is_msg_public(snac, p_msg) && | 555 | if (is_msg_public(snac, p_msg) && |
| 556 | xs_list_in(to, (char *)public_address) == -1) | 556 | xs_list_in(to, public_address) == -1) |
| 557 | to = xs_list_append(to, public_address); | 557 | to = xs_list_append(to, public_address); |
| 558 | } | 558 | } |
| 559 | 559 | ||
| @@ -526,10 +526,10 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referr | |||
| 526 | fclose(f); | 526 | fclose(f); |
| 527 | 527 | ||
| 528 | xs *g_msg = xs_json_loads(j); | 528 | xs *g_msg = xs_json_loads(j); |
| 529 | d_char *meta = xs_dict_get(g_msg, "_snac"); | 529 | char *meta = xs_dict_get(g_msg, "_snac"); |
| 530 | d_char *p = xs_dict_get(meta, "parent"); | 530 | char *p = xs_dict_get(meta, "parent"); |
| 531 | 531 | ||
| 532 | free(grampa); | 532 | xs_free(grampa); |
| 533 | grampa = xs_dup(p); | 533 | grampa = xs_dup(p); |
| 534 | } | 534 | } |
| 535 | } | 535 | } |
| @@ -183,10 +183,8 @@ void httpd_connection(FILE *f) | |||
| 183 | b_size = strlen(body); | 183 | b_size = strlen(body); |
| 184 | 184 | ||
| 185 | /* if it was a HEAD, no body will be sent */ | 185 | /* if it was a HEAD, no body will be sent */ |
| 186 | if (strcmp(method, "HEAD") == 0) { | 186 | if (strcmp(method, "HEAD") == 0) |
| 187 | free(body); | 187 | body = xs_free(body); |
| 188 | body = NULL; | ||
| 189 | } | ||
| 190 | 188 | ||
| 191 | xs_httpd_response(f, status, headers, body, b_size); | 189 | xs_httpd_response(f, status, headers, body, b_size); |
| 192 | 190 | ||
| @@ -194,7 +192,7 @@ void httpd_connection(FILE *f) | |||
| 194 | 192 | ||
| 195 | srv_archive("RECV", req, payload, p_size, status, headers, body, b_size); | 193 | srv_archive("RECV", req, payload, p_size, status, headers, body, b_size); |
| 196 | 194 | ||
| 197 | free(body); | 195 | xs_free(body); |
| 198 | } | 196 | } |
| 199 | 197 | ||
| 200 | 198 | ||
| @@ -233,18 +231,21 @@ static void *queue_thread(void *arg) | |||
| 233 | srv_log(xs_fmt("queue thread start")); | 231 | srv_log(xs_fmt("queue thread start")); |
| 234 | 232 | ||
| 235 | while (srv_running) { | 233 | while (srv_running) { |
| 236 | xs *list = user_list(); | ||
| 237 | char *p, *uid; | ||
| 238 | time_t t; | 234 | time_t t; |
| 239 | 235 | ||
| 240 | /* process queues for all users */ | 236 | { |
| 241 | p = list; | 237 | xs *list = user_list(); |
| 242 | while (xs_list_iter(&p, &uid)) { | 238 | char *p, *uid; |
| 243 | snac snac; | 239 | |
| 240 | /* process queues for all users */ | ||
| 241 | p = list; | ||
| 242 | while (xs_list_iter(&p, &uid)) { | ||
| 243 | snac snac; | ||
| 244 | 244 | ||
| 245 | if (user_open(&snac, uid)) { | 245 | if (user_open(&snac, uid)) { |
| 246 | process_queue(&snac); | 246 | process_queue(&snac); |
| 247 | user_free(&snac); | 247 | user_free(&snac); |
| 248 | } | ||
| 248 | } | 249 | } |
| 249 | } | 250 | } |
| 250 | 251 | ||
| @@ -66,7 +66,7 @@ d_char *xs_list_append_m(d_char *list, const char *mem, int dsz); | |||
| 66 | int xs_list_iter(char **list, char **value); | 66 | int xs_list_iter(char **list, char **value); |
| 67 | int xs_list_len(char *list); | 67 | int xs_list_len(char *list); |
| 68 | char *xs_list_get(char *list, int num); | 68 | char *xs_list_get(char *list, int num); |
| 69 | int xs_list_in(char *list, char *val); | 69 | int xs_list_in(char *list, const char *val); |
| 70 | d_char *xs_join(char *list, const char *sep); | 70 | d_char *xs_join(char *list, const char *sep); |
| 71 | d_char *xs_split_n(const char *str, const char *sep, int times); | 71 | d_char *xs_split_n(const char *str, const char *sep, int times); |
| 72 | #define xs_split(str, sep) xs_split_n(str, sep, 0xfffffff) | 72 | #define xs_split(str, sep) xs_split_n(str, sep, 0xfffffff) |
| @@ -96,12 +96,27 @@ void *_xs_realloc(void *ptr, size_t size, const char *file, int line, const char | |||
| 96 | 96 | ||
| 97 | #ifdef XS_DEBUG | 97 | #ifdef XS_DEBUG |
| 98 | if (ndata != ptr) { | 98 | if (ndata != ptr) { |
| 99 | int n; | ||
| 99 | FILE *f = fopen("xs_memory.out", "a"); | 100 | FILE *f = fopen("xs_memory.out", "a"); |
| 100 | 101 | ||
| 101 | if (ptr != NULL) | 102 | if (ptr != NULL) |
| 102 | fprintf(f, "%p r\n", ptr); | 103 | fprintf(f, "%p r\n", ptr); |
| 103 | 104 | ||
| 104 | fprintf(f, "%p a %ld %s %d %s\n", ndata, size, file, line, func); | 105 | fprintf(f, "%p a %ld %s:%d: %s", ndata, size, file, line, func); |
| 106 | |||
| 107 | if (ptr != NULL) { | ||
| 108 | fprintf(f, " ["); | ||
| 109 | for (n = 0; n < 32 && ndata[n]; n++) { | ||
| 110 | if (ndata[n] >= 32 && ndata[n] <= 127) | ||
| 111 | fprintf(f, "%c", ndata[n]); | ||
| 112 | else | ||
| 113 | fprintf(f, "\\%02x", (unsigned char)ndata[n]); | ||
| 114 | } | ||
| 115 | fprintf(f, "]"); | ||
| 116 | } | ||
| 117 | |||
| 118 | fprintf(f, "\n"); | ||
| 119 | |||
| 105 | fclose(f); | 120 | fclose(f); |
| 106 | } | 121 | } |
| 107 | #endif | 122 | #endif |
| @@ -531,7 +546,7 @@ char *xs_list_get(char *list, int num) | |||
| 531 | } | 546 | } |
| 532 | 547 | ||
| 533 | 548 | ||
| 534 | int xs_list_in(char *list, char *val) | 549 | int xs_list_in(char *list, const char *val) |
| 535 | /* returns the position of val in list or -1 */ | 550 | /* returns the position of val in list or -1 */ |
| 536 | { | 551 | { |
| 537 | int n = 0; | 552 | int n = 0; |
diff --git a/xs_version.h b/xs_version.h index 4ed093c..8a9d469 100644 --- a/xs_version.h +++ b/xs_version.h | |||
| @@ -1 +1 @@ | |||
| /* 286f556255aa224a72b778c44b837b75170becf5 */ | /* 870b15e48a153ac601046ac2dc72dd8ccb0c77a4 */ | ||