*/
}
- if ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_ALWS &&
- !LIST_ISEMPTY(&srv->idle_conns)) {
+ if (((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_ALWS ||
+ ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_SAFE && s->txn && (s->txn->flags & TX_NOT_FIRST)))
+ && !LIST_ISEMPTY(&srv->idle_conns)) {
/* We're going to have to pick the first connection
* from this pool and use it for our purposes. We may
* have to get rid of the current idle connection, so
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
goto out;
}
+ else if (strcmp(args[1], "safe") == 0) {
+ /* enable a graceful server shutdown on an HTTP 404 response */
+ curproxy->options &= ~PR_O_REUSE_MASK;
+ curproxy->options |= PR_O_REUSE_SAFE;
+ if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
+ goto out;
+ }
else if (strcmp(args[1], "always") == 0) {
/* enable a graceful server shutdown on an HTTP 404 response */
curproxy->options &= ~PR_O_REUSE_MASK;
goto out;
}
else {
- Alert("parsing [%s:%d] : '%s' only supports 'never', 'always'.\n", file, linenum, args[0]);
+ Alert("parsing [%s:%d] : '%s' only supports 'never', 'safe', 'always'.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}