diff options
| author | grunfink <grunfink@comam.es> | 2025-09-28 14:26:18 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2025-09-28 14:26:18 +0200 |
| commit | 335b90a9d1654aadb4e0d87114b82685defcd50b (patch) | |
| tree | 70cf0ee4da330fe1846ee9769a1e534b394a1898 /data.c | |
| parent | 144eb7bfbcd76e2ae85bad0f7a333622449d9966 (diff) | |
New function actor_failure().
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -3042,18 +3042,13 @@ xs_list *content_search(snac *user, const char *regex, } -int instance_failure(const char *url, int op) -/* do some checks and accounting on instance failures */ +int actor_failure(const char *id, int op) +/* actor failure maintenance */ { int ret = 0; - xs *l = xs_split(url, "/"); - const char *hostname = xs_list_get(l, 2); double mt; - if (!xs_is_string(hostname)) - return 0; - - xs *md5 = xs_md5_hex(hostname, strlen(hostname)); + xs *md5 = xs_md5_hex(id, strlen(id)); xs *fn = xs_fmt("%s/failure/%s", srv_basedir, md5); switch (op) { @@ -3075,7 +3070,7 @@ int instance_failure(const char *url, int op) /* only create once, as the date will be used */ if ((f = fopen(fn, "w")) != NULL) { - fprintf(f, "%s\n", hostname); + fprintf(f, "%s\n", id); fclose(f); } } @@ -3093,6 +3088,20 @@ int instance_failure(const char *url, int op) } +int instance_failure(const char *url, int op) +/* instance failure maintenance */ +{ + /* extract just the host name */ + xs *l = xs_split(url, "/"); + const char *hostname = xs_list_get(l, 2); + + if (!xs_is_string(hostname)) + return 0; + + return actor_failure(hostname, op); +} + + /** notifications **/ xs_str *notify_check_time(snac *snac, int reset) |