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