CO_FL_IDLE_LIST = 0x00000002, /* 2 = in idle_list, 3 = invalid */
CO_FL_LIST_MASK = 0x00000003, /* Is the connection in any server-managed list ? */
- CO_FL_REVERSED = 0x00000004, /* connection has been reversed but not yet accepted */
+ CO_FL_REVERSED = 0x00000004, /* connection has been reversed to backend / reversed and accepted on frontend */
+ CO_FL_ACT_REVERSING = 0x00000008, /* connection has been reversed to frontend but not yet accepted */
/* unused : 0x00000008 */
/* unused : 0x00000010 */
static inline int conn_reverse_in_preconnect(const struct connection *conn)
{
return conn_is_back(conn) ? !!(conn->reverse.target) :
- !!(conn->flags & CO_FL_REVERSED);
+ !!(conn->flags & CO_FL_ACT_REVERSING);
}
/* Initialize <conn> as a reverse connection to <target>. */
sess->origin = NULL;
session_free(sess);
conn_set_owner(conn, NULL, NULL);
+
+ conn->flags |= CO_FL_REVERSED;
}
else {
/* Wake up receiver to proceed to connection accept. */
conn_backend_deinit(conn);
conn->target = &l->obj_type;
- conn->flags |= CO_FL_REVERSED;
+ conn->flags |= CO_FL_ACT_REVERSING;
task_wakeup(l->rx.reverse_connect.task, TASK_WOKEN_ANY);
}
}
else {
/* Spurrious receiver task woken up despite pend_conn not ready/on error. */
- BUG_ON(!(conn->flags & CO_FL_REVERSED));
+ BUG_ON(!(conn->flags & CO_FL_ACT_REVERSING));
/* A connection is ready to be accepted. */
listener_accept(l);
}
/* listener_accept() must not be called if no pending connection is not yet reversed. */
- BUG_ON(!(conn->flags & CO_FL_REVERSED));
- conn->flags &= ~CO_FL_REVERSED;
+ BUG_ON(!(conn->flags & CO_FL_ACT_REVERSING));
+ conn->flags &= ~CO_FL_ACT_REVERSING;
+ conn->flags |= CO_FL_REVERSED;
conn->mux->ctl(conn, MUX_REVERSE_CONN, NULL);
l->rx.reverse_connect.pend_conn = NULL;