ret = conn->ctrl->connect(conn, !channel_is_empty(si->ob), 0);
if (ret != SN_ERR_NONE)
return ret;
+
+ /* we need to be notified about connection establishment */
+ conn->flags |= CO_FL_WAKE_DATA;
+
+ /* we're in the process of establishing a connection */
+ si->state = SI_ST_CON;
}
else if (!channel_is_empty(si->ob)) {
/* reuse the existing connection, we'll have to send a
* request there.
*/
conn_data_want_send(conn);
+
+ /* the connection is established */
+ si->state = SI_ST_EST;
}
/* needs src ip/port for logging */
if (si->flags & SI_FL_SRC_ADDR)
conn_get_from_addr(conn);
- /* we need to be notified about connection establishment */
- conn->flags |= CO_FL_WAKE_DATA;
-
- /* we're in the process of establishing a connection */
- si->state = SI_ST_CON;
-
return ret;
}
/* Update stream interface status for input states SI_ST_ASS, SI_ST_QUE, SI_ST_TAR.
* Other input states are simply ignored.
- * Possible output states are SI_ST_CLO, SI_ST_TAR, SI_ST_ASS, SI_ST_REQ, SI_ST_CON.
- * Flags must have previously been updated for timeouts and other conditions.
+ * Possible output states are SI_ST_CLO, SI_ST_TAR, SI_ST_ASS, SI_ST_REQ, SI_ST_CON
+ * and SI_ST_EST. Flags must have previously been updated for timeouts and other
+ * conditions.
*/
static void sess_update_stream_int(struct session *s, struct stream_interface *si)
{
srv = objt_server(s->target);
if (conn_err == SN_ERR_NONE) {
- /* state = SI_ST_CON now */
+ /* state = SI_ST_CON or SI_ST_EST now */
if (srv)
srv_inc_sess_ctr(srv);
return;
if (s->si[1].state == SI_ST_REQ)
sess_prepare_conn_req(s, &s->si[1]);
- /* applets directly go to the ESTABLISHED state */
+ /* applets directly go to the ESTABLISHED state. Similarly,
+ * servers experience the same fate when their connection
+ * is reused.
+ */
if (unlikely(s->si[1].state == SI_ST_EST))
sess_establish(s, &s->si[1]);