Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
Minor cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsch committed Mar 8, 2016
1 parent e4e4e21 commit 2725865
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bin/varnishd/cache/cache_backend_tcp.c
Expand Up @@ -231,15 +231,15 @@ VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa)
*sa = tp->ip6;
s = VTCP_connect(tp->ip6, msec);
if (s >= 0)
return(s);
return (s);
}
*sa = tp->ip4;
s = VTCP_connect(tp->ip4, msec);
if (s < 0 && !cache_param->prefer_ipv6) {
*sa = tp->ip6;
s = VTCP_connect(tp->ip6, msec);
}
return(s);
return (s);
}

/*--------------------------------------------------------------------
Expand Down Expand Up @@ -360,7 +360,7 @@ VBT_Get(struct tcp_pool *tp, double tmo, const struct backend *be,
VTAILQ_REMOVE(&tp->connlist, vbc, list);
VTAILQ_INSERT_TAIL(&tp->connlist, vbc, list);
tp->n_conn--;
VSC_C_main->backend_reuse += 1;
VSC_C_main->backend_reuse++;
vbc->state = VBC_STATE_STOLEN;
vbc->cond = &wrk->cond;
}
Expand All @@ -376,9 +376,8 @@ VBT_Get(struct tcp_pool *tp, double tmo, const struct backend *be,
vbc->state = VBC_STATE_USED;
vbc->tcp_pool = tp;
vbc->fd = VBT_Open(tp, tmo, &vbc->addr);
if (vbc->fd < 0)
if (vbc->fd < 0) {
FREE_OBJ(vbc);
if (vbc == NULL) {
Lck_Lock(&tp->mtx);
tp->n_used--; // Nope, didn't work after all.
Lck_Unlock(&tp->mtx);
Expand Down

0 comments on commit 2725865

Please sign in to comment.