Browse Source

Send notready message when notify data is not ready in the generator instead of no response

master
Con Kolivas 10 years ago
parent
commit
f02a35dfcf
  1. 5
      src/generator.c
  2. 4
      src/stratifier.c

5
src/generator.c

@ -1145,7 +1145,8 @@ static void send_notify(proxy_instance_t *proxi, int *sockd)
ni = proxi->current_notify; ni = proxi->current_notify;
if (unlikely(!ni)) { if (unlikely(!ni)) {
mutex_unlock(&proxi->notify_lock); mutex_unlock(&proxi->notify_lock);
goto out_close; ASPRINTF(&msg, "notready");
goto out_send;
} }
for (i = 0; i < ni->merkles; i++) for (i = 0; i < ni->merkles; i++)
json_array_append_new(merkle_arr, json_string(&ni->merklehash[i][0])); 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); msg = json_dumps(json_msg, JSON_NO_UTF8);
json_decref(json_msg); json_decref(json_msg);
out_send:
send_unix_msg(*sockd, msg); send_unix_msg(*sockd, msg);
free(msg); free(msg);
out_close:
_Close(sockd); _Close(sockd);
} }

4
src/stratifier.c

@ -1103,6 +1103,10 @@ static void update_notify(ckpool_t *ckp)
LOGWARNING("Failed to get notify from generator in update_notify"); LOGWARNING("Failed to get notify from generator in update_notify");
return; return;
} }
if (unlikely(!safecmp(buf, "notready"))) {
LOGNOTICE("Generator not ready to send notify to stratifier");
return;
}
proxy = current_proxy(sdata); proxy = current_proxy(sdata);
if (unlikely(!proxy || !proxy->subscribed)) { if (unlikely(!proxy || !proxy->subscribed)) {

Loading…
Cancel
Save