}
/* Try to allocate a new connection and assign it to the interface. If
- * a connection was previously allocated and the <reuse> flag is set,
- * it is returned unmodified. Otherwise it is reset.
+ * an endpoint was previously allocated, it is released first. The newly
+ * allocated connection is initialized, assigned to the stream interface,
+ * and returned.
*/
-/* Returns the stream interface's existing connection if one such already
- * exists, or tries to allocate and initialize a new one which is then
- * assigned to the stream interface.
- */
-static inline struct connection *si_alloc_conn(struct stream_interface *si, int reuse)
+static inline struct connection *si_alloc_conn(struct stream_interface *si)
{
struct connection *conn;
- /* If we find a reusable connection, we return it, otherwise we start
- * by releasing what we have (non-reusable conn or applet).
- */
- if (si->end) {
- conn = objt_conn(si->end);
- if (conn && reuse)
- return conn;
-
- si_release_endpoint(si);
- }
+ si_release_endpoint(si);
conn = conn_new();
if (conn)
ip = MAY_LJMP(luaL_checkstring(L, 2));
port = MAY_LJMP(luaL_checkinteger(L, 3));
- conn = si_alloc_conn(&socket->s->si[1], 0);
+ conn = si_alloc_conn(&socket->s->si[1]);
if (!conn)
WILL_LJMP(luaL_error(L, "connect: internal error"));
char *path;
/* Note that for now we don't reuse existing proxy connections */
- if (unlikely((conn = si_alloc_conn(&s->si[1], 0)) == NULL)) {
+ if (unlikely((conn = si_alloc_conn(&s->si[1])) == NULL)) {
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 500;
req->analysers = 0;