|
|
@ -908,10 +908,10 @@ static void broadcast_ping(sdata_t *sdata); |
|
|
|
static void *do_update(void *arg) |
|
|
|
static void *do_update(void *arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct update_req *ur = (struct update_req *)arg; |
|
|
|
struct update_req *ur = (struct update_req *)arg; |
|
|
|
|
|
|
|
int prio = ur->prio, retries = 0; |
|
|
|
ckpool_t *ckp = ur->ckp; |
|
|
|
ckpool_t *ckp = ur->ckp; |
|
|
|
sdata_t *sdata = ckp->data; |
|
|
|
sdata_t *sdata = ckp->data; |
|
|
|
bool new_block = false; |
|
|
|
bool new_block = false; |
|
|
|
int prio = ur->prio; |
|
|
|
|
|
|
|
bool ret = false; |
|
|
|
bool ret = false; |
|
|
|
workbase_t *wb; |
|
|
|
workbase_t *wb; |
|
|
|
time_t now_t; |
|
|
|
time_t now_t; |
|
|
@ -921,15 +921,20 @@ static void *do_update(void *arg) |
|
|
|
pthread_detach(pthread_self()); |
|
|
|
pthread_detach(pthread_self()); |
|
|
|
rename_proc("updater"); |
|
|
|
rename_proc("updater"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retry: |
|
|
|
buf = send_recv_generator(ckp, "getbase", prio); |
|
|
|
buf = send_recv_generator(ckp, "getbase", prio); |
|
|
|
if (unlikely(!buf)) { |
|
|
|
if (unlikely(!buf)) { |
|
|
|
LOGNOTICE("Get base in update_base delayed due to higher priority request"); |
|
|
|
LOGNOTICE("Get base in update_base delayed due to higher priority request"); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (unlikely(cmdmatch(buf, "failed"))) { |
|
|
|
if (unlikely(cmdmatch(buf, "failed"))) { |
|
|
|
LOGWARNING("Generator returned failure in update_base"); |
|
|
|
if (retries++ < 5 || prio == GEN_PRIORITY) { |
|
|
|
goto out; |
|
|
|
LOGWARNING("Generator returned failure in update_base, retry #%d", retries); |
|
|
|
|
|
|
|
goto retry; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (unlikely(retries)) |
|
|
|
|
|
|
|
LOGWARNING("Generator succeeded in update_base after retrying"); |
|
|
|
|
|
|
|
|
|
|
|
wb = ckzalloc(sizeof(workbase_t)); |
|
|
|
wb = ckzalloc(sizeof(workbase_t)); |
|
|
|
wb->ckp = ckp; |
|
|
|
wb->ckp = ckp; |
|
|
|