void stream_int_report_error(struct stream_interface *si);
void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg);
int conn_si_send_proxy(struct connection *conn, unsigned int flag);
-void conn_notify_si(struct connection *conn);
int stream_int_shutr(struct stream_interface *si);
int stream_int_shutw(struct stream_interface *si);
-void si_conn_recv_cb(struct connection *conn);
-void si_conn_send_cb(struct connection *conn);
void stream_sock_read0(struct stream_interface *si);
extern struct si_ops si_embedded_ops;
si->conn.flags |= CO_FL_SI_SEND_PROXY;
/* we need to be notified about connection establishment */
- si->conn.flags |= CO_FL_NOTIFY_SI;
+ si->conn.flags |= CO_FL_WAKE_DATA;
/* we're in the process of establishing a connection */
si->state = SI_ST_CON;
CO_FL_WAIT_L4_CONN = 0x00000004, /* waiting for L4 to be connected */
CO_FL_WAIT_L6_CONN = 0x00000008, /* waiting for L6 to be connected (eg: SSL) */
- CO_FL_NOTIFY_SI = 0x00000010, /* notify stream interface about changes */
+ CO_FL_WAKE_DATA = 0x00000010, /* wake-up data layer upon activity at the transport layer */
/* flags below are used for connection handshakes */
CO_FL_SI_SEND_PROXY = 0x00000020, /* send a valid PROXY protocol header */
/* data_cb describes the data layer's recv and send callbacks which are called
* when I/O activity was detected after the transport layer is ready. These
* callbacks are supposed to make use of the xprt_ops above to exchange data
- * from/to buffers and pipes.
+ * from/to buffers and pipes. The <wake> callback is used to report activity
+ * at the transport layer, which can be a connection opening/close, or any
+ * data movement.
*/
struct data_cb {
void (*recv)(struct connection *conn); /* data-layer recv callback */
void (*send)(struct connection *conn); /* data-layer send callback */
+ void (*wake)(struct connection *conn); /* data-layer callback to report activity */
};
/* a target describes what is on the remote side of the connection. */
return 0;
}
- if (conn->flags & CO_FL_NOTIFY_SI)
- conn_notify_si(conn);
+ if (conn->flags & CO_FL_WAKE_DATA)
+ conn->data->wake(conn);
/* Last check, verify if the connection just established */
if (unlikely(!(conn->flags & (CO_FL_WAIT_L4_CONN | CO_FL_WAIT_L6_CONN | CO_FL_CONNECTED))))
}
/* we want the connection handler to notify the stream interface about updates. */
- s->si[0].conn.flags |= CO_FL_NOTIFY_SI;
+ s->si[0].conn.flags |= CO_FL_WAKE_DATA;
/* it is important not to call the wakeup function directly but to
* pass through task_wakeup(), because this one knows how to apply
static void stream_int_update_conn(struct stream_interface *si);
static void stream_int_chk_rcv_conn(struct stream_interface *si);
static void stream_int_chk_snd_conn(struct stream_interface *si);
+static void si_conn_recv_cb(struct connection *conn);
+static void si_conn_send_cb(struct connection *conn);
+static void si_conn_wake_cb(struct connection *conn);
/* stream-interface operations for embedded tasks */
struct si_ops si_embedded_ops = {
struct data_cb si_conn_cb = {
.recv = si_conn_recv_cb,
.send = si_conn_send_cb,
+ .wake = si_conn_wake_cb,
};
/*
}
/* Callback to be used by connection I/O handlers upon completion. It differs from
- * the function below in that it is designed to be called by lower layers after I/O
+ * the update function in that it is designed to be called by lower layers after I/O
* events have been completed. It will also try to wake the associated task up if
* an important event requires special handling. It relies on the connection handler
* to commit any polling updates.
*/
-void conn_notify_si(struct connection *conn)
+static void si_conn_wake_cb(struct connection *conn)
{
struct stream_interface *si = conn->owner;
* into the buffer from the connection. It iterates over the transport layer's
* rcv_buf function.
*/
-void si_conn_recv_cb(struct connection *conn)
+static void si_conn_recv_cb(struct connection *conn)
{
struct stream_interface *si = conn->owner;
struct channel *b = si->ib;
* from the buffer to the connection. It iterates over the transport layer's
* snd_buf function.
*/
-void si_conn_send_cb(struct connection *conn)
+static void si_conn_send_cb(struct connection *conn)
{
struct stream_interface *si = conn->owner;
struct channel *b = si->ob;