MINOR: peers: don't reference the incoming listener on outgoing connections
Since v1.7 it's pointless to reference a listener when greating a session
for an outgoing connection, it only complicates the code. SPOE and Lua were
cleaned up in 1.8-dev1 but the peers code was forgotten. This patch fixes
this by not assigning such a listener for outgoing connections. It also has
the extra benefit of not discounting the outgoing connections from the number
of allowed incoming connections (the code currently adds a safety marging of
3 extra connections to take care of this).
diff --git a/src/peers.c b/src/peers.c
index d03e72f..8fb3b78 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1779,8 +1779,7 @@
*/
static struct appctx *peer_session_create(struct peers *peers, struct peer *peer)
{
- struct listener *l = LIST_NEXT(&peers->peers_fe->conf.listeners, struct listener *, by_fe);
- struct proxy *p = l->bind_conf->frontend; /* attached frontend */
+ struct proxy *p = peers->peers_fe; /* attached frontend */
struct appctx *appctx;
struct session *sess;
struct stream *s;
@@ -1797,7 +1796,7 @@
appctx->st0 = PEER_SESS_ST_CONNECT;
appctx->ctx.peers.ptr = (void *)peer;
- sess = session_new(p, l, &appctx->obj_type);
+ sess = session_new(p, NULL, &appctx->obj_type);
if (!sess) {
Alert("out of memory in peer_session_create().\n");
goto out_free_appctx;
@@ -1836,11 +1835,8 @@
s->res.flags |= CF_READ_DONTWAIT;
- l->nbconn++; /* warning! right now, it's up to the handler to decrease this */
p->feconn++;/* beconn will be increased later */
jobs++;
- if (!(s->sess->listener->options & LI_O_UNLIMITED))
- actconn++;
totalconn++;
peer->appctx = appctx;