[MINOR] do not create a socket if there is no server
Since the distinction of backends and frontends, it has become
possible that some requests reach a frontend which has no
backend parameters. We must not create a socket on the backend
side just to destroy it later in such a case. The real problem
comes from the dispatch mode not being explictly stated.
diff --git a/src/backend.c b/src/backend.c
index c0283d2..1601c40 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -186,7 +186,10 @@
else /* unknown balancing algorithm */
return SRV_STATUS_INTERNAL;
}
- s->flags |= SN_ASSIGNED;
+ else if (*(int *)&s->be->beprm->dispatch_addr.sin_addr || s->fe->options & PR_O_TRANSP)
+ s->flags |= SN_ASSIGNED;
+ else
+ return SRV_STATUS_NOSRV;
}
return SRV_STATUS_OK;
}
@@ -243,6 +246,10 @@
return SRV_STATUS_INTERNAL;
}
}
+ else {
+ /* no server and no LB algorithm ! */
+ return SRV_STATUS_INTERNAL;
+ }
s->flags |= SN_ADDR_SET;
return SRV_STATUS_OK;