/* The error was an asynchronous connection error, and we will
* likely have to retry connecting to the same server, most
* likely leading to the same result. To avoid this, we wait
- * MIN(one second, connect timeout) before retrying.
+ * MIN(one second, connect timeout) before retrying. We don't
+ * do it when the failure happened on a reused connection
+ * though.
*/
int delay = 1000;
si->err_type = SI_ET_CONN_ERR;
/* only wait when we're retrying on the same server */
- if (si->state == SI_ST_ASS ||
- (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR ||
- (s->be->srv_act <= 1)) {
+ if ((si->state == SI_ST_ASS ||
+ (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR ||
+ (s->be->srv_act <= 1)) && !(s->flags & SF_SRV_REUSED)) {
si->state = SI_ST_TAR;
si->exp = tick_add(now_ms, MS_TO_TICKS(delay));
}