MINOR: connection: provide a generic data layer wakeup callback
Instead of calling conn_notify_si() from the connection handler, we
now call data->wake(), which will allow us to use a different callback
with health checks.
Note that we still rely on a flag in order to decide whether or not
to call this function. The reason is that with embryonic sessions,
the callback is already initialized to si_conn_cb without the flag,
and we can't call the SI notify function in the leave path before
the stream interface is initialized.
This issue should be addressed by involving a different data_cb for
embryonic sessions and for stream interfaces, that would be changed
during session_complete() for the final data_cb.
diff --git a/include/types/connection.h b/include/types/connection.h
index c289efa..c8858c3 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -76,7 +76,7 @@
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 */
@@ -172,11 +172,14 @@
/* 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. */