Browse Source

There is no need to test for cs dereferencing since it cannot.

master
Con Kolivas 8 years ago
parent
commit
44af2dcbb7
  1. 14
      src/generator.c

14
src/generator.c

@ -810,10 +810,6 @@ json_t *generator_genbase(ckpool_t *ckp)
goto out; goto out;
} }
cs = &si->cs; cs = &si->cs;
if (unlikely(!cs)) {
LOGWARNING("No live connsock for current server in generator_genbase");
goto out;
}
if (unlikely(!gen_gbtbase(cs, &gbt))) { if (unlikely(!gen_gbtbase(cs, &gbt))) {
LOGWARNING("Failed to get block template from %s:%s", cs->url, cs->port); LOGWARNING("Failed to get block template from %s:%s", cs->url, cs->port);
si->alive = cs->alive = false; si->alive = cs->alive = false;
@ -834,7 +830,6 @@ int generator_getbest(ckpool_t *ckp, char *hash)
server_instance_t *si; server_instance_t *si;
connsock_t *cs; connsock_t *cs;
/* Use temporary variables to prevent deref while accessing */
si = gdata->current_si; si = gdata->current_si;
if (unlikely(!si)) { if (unlikely(!si)) {
LOGWARNING("No live current server in generator_getbest"); LOGWARNING("No live current server in generator_getbest");
@ -845,10 +840,6 @@ int generator_getbest(ckpool_t *ckp, char *hash)
goto out; goto out;
} }
cs = &si->cs; cs = &si->cs;
if (unlikely(!cs)) {
LOGWARNING("No live connsock for current server in generator_getbest");
goto out;
}
if (unlikely(!get_bestblockhash(cs, hash))) { if (unlikely(!get_bestblockhash(cs, hash))) {
LOGWARNING("Failed to get best block hash from %s:%s", cs->url, cs->port); LOGWARNING("Failed to get best block hash from %s:%s", cs->url, cs->port);
goto out; goto out;
@ -865,17 +856,12 @@ bool generator_checkaddr(ckpool_t *ckp, const char *addr)
int ret = false; int ret = false;
connsock_t *cs; connsock_t *cs;
/* Use temporary variables to prevent deref while accessing */
si = gdata->current_si; si = gdata->current_si;
if (unlikely(!si)) { if (unlikely(!si)) {
LOGWARNING("No live current server in generator_checkaddr"); LOGWARNING("No live current server in generator_checkaddr");
goto out; goto out;
} }
cs = &si->cs; cs = &si->cs;
if (unlikely(!cs)) {
LOGWARNING("No live connsock for current server in generator_checkaddr");
goto out;
}
ret = validate_address(cs, addr); ret = validate_address(cs, addr);
out: out:
return ret; return ret;

Loading…
Cancel
Save