[BUG] last backend change broke server assignment

Due to a change in the if/else paths, s->flags did not receive
the SN_ASSIGNED value anymore.
This commit is contained in:
Willy Tarreau 2007-01-21 12:47:26 +01:00
parent 1a1158b0bd
commit 5d65bbb2aa
1 changed files with 10 additions and 5 deletions

View File

@ -160,7 +160,11 @@ int assign_server(struct session *s)
return SRV_STATUS_INTERNAL; return SRV_STATUS_INTERNAL;
if (!(s->flags & SN_ASSIGNED)) { if (!(s->flags & SN_ASSIGNED)) {
if ((s->be->beprm->options & PR_O_BALANCE) && !(s->flags & SN_DIRECT)) { if (s->be->beprm->options & PR_O_BALANCE) {
if (s->flags & SN_DIRECT) {
s->flags |= SN_ASSIGNED;
return SRV_STATUS_OK;
}
if (!s->be->beprm->srv_act && !s->be->beprm->srv_bck) if (!s->be->beprm->srv_act && !s->be->beprm->srv_bck)
return SRV_STATUS_NOSRV; return SRV_STATUS_NOSRV;
@ -186,10 +190,11 @@ int assign_server(struct session *s)
else /* unknown balancing algorithm */ else /* unknown balancing algorithm */
return SRV_STATUS_INTERNAL; return SRV_STATUS_INTERNAL;
} }
else if (*(int *)&s->be->beprm->dispatch_addr.sin_addr || s->fe->options & PR_O_TRANSP) else if (!*(int *)&s->be->beprm->dispatch_addr.sin_addr &&
s->flags |= SN_ASSIGNED; !(s->fe->options & PR_O_TRANSP)) {
else
return SRV_STATUS_NOSRV; return SRV_STATUS_NOSRV;
}
s->flags |= SN_ASSIGNED;
} }
return SRV_STATUS_OK; return SRV_STATUS_OK;
} }
@ -214,7 +219,7 @@ int assign_server_address(struct session *s)
fprintf(stderr,"assign_server_address : s=%p\n",s); fprintf(stderr,"assign_server_address : s=%p\n",s);
#endif #endif
if (s->flags & SN_DIRECT || s->be->beprm->options & PR_O_BALANCE) { if ((s->flags & SN_DIRECT) || (s->be->beprm->options & PR_O_BALANCE)) {
/* A server is necessarily known for this session */ /* A server is necessarily known for this session */
if (!(s->flags & SN_ASSIGNED)) if (!(s->flags & SN_ASSIGNED))
return SRV_STATUS_INTERNAL; return SRV_STATUS_INTERNAL;