From f02a35dfcfff8e562541f4bba598e1983444b52b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 6 Feb 2015 18:20:18 +1100 Subject: [PATCH] Send notready message when notify data is not ready in the generator instead of no response --- src/generator.c | 5 +++-- src/stratifier.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index a50a40ae..75e55dff 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1145,7 +1145,8 @@ static void send_notify(proxy_instance_t *proxi, int *sockd) ni = proxi->current_notify; if (unlikely(!ni)) { mutex_unlock(&proxi->notify_lock); - goto out_close; + ASPRINTF(&msg, "notready"); + goto out_send; } for (i = 0; i < ni->merkles; i++) json_array_append_new(merkle_arr, json_string(&ni->merklehash[i][0])); @@ -1160,9 +1161,9 @@ static void send_notify(proxy_instance_t *proxi, int *sockd) msg = json_dumps(json_msg, JSON_NO_UTF8); json_decref(json_msg); +out_send: send_unix_msg(*sockd, msg); free(msg); -out_close: _Close(sockd); } diff --git a/src/stratifier.c b/src/stratifier.c index b0b0ebc1..bd194998 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1103,6 +1103,10 @@ static void update_notify(ckpool_t *ckp) LOGWARNING("Failed to get notify from generator in update_notify"); return; } + if (unlikely(!safecmp(buf, "notready"))) { + LOGNOTICE("Generator not ready to send notify to stratifier"); + return; + } proxy = current_proxy(sdata); if (unlikely(!proxy || !proxy->subscribed)) {