MINOR: peers: make use of session_new() when creating a new session

It's better than open-coding it.
This commit is contained in:
Willy Tarreau 2015-04-05 00:39:55 +02:00
parent 64beab202c
commit 4099a7c273

View File

@ -1128,19 +1128,12 @@ static struct stream *peer_session_create(struct peer *peer, struct peer_session
appctx->st0 = PEER_SESS_ST_CONNECT; appctx->st0 = PEER_SESS_ST_CONNECT;
appctx->ctx.peers.ptr = (void *)ps; appctx->ctx.peers.ptr = (void *)ps;
sess = pool_alloc2(pool2_session); sess = session_new(p, l, &appctx->obj_type);
if (!sess) { if (!sess) {
Alert("out of memory in peer_session_create().\n"); Alert("out of memory in peer_session_create().\n");
goto out_free_appctx; goto out_free_appctx;
} }
sess->listener = l;
sess->fe = p;
sess->origin = &appctx->obj_type;
sess->accept_date = date; /* user-visible date for logging */
sess->tv_accept = now; /* corrected date for internal use */
memset(sess->stkctr, 0, sizeof(sess->stkctr));
if ((s = pool_alloc2(pool2_stream)) == NULL) { /* disable this proxy for a while */ if ((s = pool_alloc2(pool2_stream)) == NULL) { /* disable this proxy for a while */
Alert("out of memory in peer_session_create().\n"); Alert("out of memory in peer_session_create().\n");
goto out_free_sess; goto out_free_sess;