Do not accept proxy notify update until subscription complete
This commit is contained in:
parent
e326d36be5
commit
08f7f39836
@ -155,6 +155,8 @@ static struct {
|
||||
|
||||
int nonce2len;
|
||||
int enonce2varlen;
|
||||
|
||||
bool subscribed;
|
||||
} proxy_base;
|
||||
|
||||
static int64_t workbase_id;
|
||||
@ -760,6 +762,7 @@ static bool update_subscribe(ckpool_t *ckp)
|
||||
free(buf);
|
||||
|
||||
ck_wlock(&workbase_lock);
|
||||
proxy_base.subscribed = true;
|
||||
proxy_base.diff = ckp->startdiff;
|
||||
/* Length is checked by generator */
|
||||
strcpy(proxy_base.enonce1, json_string_value(json_object_get(val, "enonce1")));
|
||||
@ -794,6 +797,11 @@ static void update_notify(ckpool_t *ckp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (unlikely(!proxy_base.subscribed)) {
|
||||
LOGINFO("No valid proxy subscription to update notify yet");
|
||||
return;
|
||||
}
|
||||
|
||||
LOGDEBUG("Update notify: %s", buf);
|
||||
wb = ckzalloc(sizeof(workbase_t));
|
||||
val = json_loads(buf, 0, NULL);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user