summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'data.c')
-rw-r--r--data.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/data.c b/data.c
index 4a16a82..3b9840e 100644
--- a/data.c
+++ b/data.c
@@ -3042,18 +3042,13 @@ xs_list *content_search(snac *user, const char *regex,
3042} 3042}
3043 3043
3044 3044
3045int instance_failure(const char *url, int op) 3045int actor_failure(const char *id, int op)
3046/* do some checks and accounting on instance failures */ 3046/* actor failure maintenance */
3047{ 3047{
3048 int ret = 0; 3048 int ret = 0;
3049 xs *l = xs_split(url, "/");
3050 const char *hostname = xs_list_get(l, 2);
3051 double mt; 3049 double mt;
3052 3050
3053 if (!xs_is_string(hostname)) 3051 xs *md5 = xs_md5_hex(id, strlen(id));
3054 return 0;
3055
3056 xs *md5 = xs_md5_hex(hostname, strlen(hostname));
3057 xs *fn = xs_fmt("%s/failure/%s", srv_basedir, md5); 3052 xs *fn = xs_fmt("%s/failure/%s", srv_basedir, md5);
3058 3053
3059 switch (op) { 3054 switch (op) {
@@ -3075,7 +3070,7 @@ int instance_failure(const char *url, int op)
3075 3070
3076 /* only create once, as the date will be used */ 3071 /* only create once, as the date will be used */
3077 if ((f = fopen(fn, "w")) != NULL) { 3072 if ((f = fopen(fn, "w")) != NULL) {
3078 fprintf(f, "%s\n", hostname); 3073 fprintf(f, "%s\n", id);
3079 fclose(f); 3074 fclose(f);
3080 } 3075 }
3081 } 3076 }
@@ -3093,6 +3088,20 @@ int instance_failure(const char *url, int op)
3093} 3088}
3094 3089
3095 3090
3091int instance_failure(const char *url, int op)
3092/* instance failure maintenance */
3093{
3094 /* extract just the host name */
3095 xs *l = xs_split(url, "/");
3096 const char *hostname = xs_list_get(l, 2);
3097
3098 if (!xs_is_string(hostname))
3099 return 0;
3100
3101 return actor_failure(hostname, op);
3102}
3103
3104
3096/** notifications **/ 3105/** notifications **/
3097 3106
3098xs_str *notify_check_time(snac *snac, int reset) 3107xs_str *notify_check_time(snac *snac, int reset)