REORG: connection: rename app_cb "data"
Now conn->data will designate the data layer which is the client for the transport layer. In practice it's the stream interface and will soon also be the health checks.
This commit is contained in:
parent
f7bc57ca6e
commit
74beec32a5
@ -412,14 +412,14 @@ static inline void conn_get_to_addr(struct connection *conn)
|
||||
conn->flags |= CO_FL_ADDR_TO_SET;
|
||||
}
|
||||
|
||||
/* prepares a connection with the appropriate app_cb, ctrl and transport layers.
|
||||
/* prepares a connection with the appropriate data, ctrl and transport layers.
|
||||
* The data state and context are set to 0, and the connection's owner is set.
|
||||
*/
|
||||
static inline void conn_prepare(struct connection *conn, const struct app_cb *app,
|
||||
static inline void conn_prepare(struct connection *conn, const struct data_cb *data,
|
||||
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
||||
void *owner)
|
||||
{
|
||||
conn->app_cb = app;
|
||||
conn->data = data;
|
||||
conn->ctrl = ctrl;
|
||||
conn->xprt = xprt;
|
||||
conn->owner = owner;
|
||||
|
@ -46,7 +46,7 @@ void stream_sock_read0(struct stream_interface *si);
|
||||
extern struct si_ops si_embedded_ops;
|
||||
extern struct si_ops si_task_ops;
|
||||
extern struct si_ops si_conn_ops;
|
||||
extern struct app_cb si_conn_cb;
|
||||
extern struct data_cb si_conn_cb;
|
||||
|
||||
struct task *stream_int_register_handler(struct stream_interface *si,
|
||||
struct si_applet *app);
|
||||
|
@ -169,14 +169,14 @@ struct xprt_ops {
|
||||
int (*init)(struct connection *conn); /* initialize the transport layer */
|
||||
};
|
||||
|
||||
/* app_cb describes the data layer's recv and send callbacks which are called
|
||||
/* 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.
|
||||
*/
|
||||
struct app_cb {
|
||||
void (*recv)(struct connection *conn); /* application-layer recv callback */
|
||||
void (*send)(struct connection *conn); /* application-layer send callback */
|
||||
struct data_cb {
|
||||
void (*recv)(struct connection *conn); /* data-layer recv callback */
|
||||
void (*send)(struct connection *conn); /* data-layer send callback */
|
||||
};
|
||||
|
||||
/* a target describes what is on the remote side of the connection. */
|
||||
@ -202,7 +202,7 @@ struct target {
|
||||
struct connection {
|
||||
const struct xprt_ops *xprt; /* operations at the transport layer */
|
||||
const struct protocol *ctrl; /* operations at the socket layer */
|
||||
const struct app_cb *app_cb; /* application layer callbacks */
|
||||
const struct data_cb *data; /* data layer callbacks */
|
||||
void *owner; /* pointer to upper layer's entity (eg: stream interface) */
|
||||
union { /* definitions which depend on connection type */
|
||||
struct { /*** information used by socket-based connections ***/
|
||||
|
@ -78,11 +78,11 @@ int conn_fd_handler(int fd)
|
||||
/* The data transfer starts here and stops on error and handshakes */
|
||||
if ((fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR)) &&
|
||||
!(conn->flags & (CO_FL_WAIT_RD|CO_FL_WAIT_ROOM|CO_FL_ERROR|CO_FL_HANDSHAKE)))
|
||||
conn->app_cb->recv(conn);
|
||||
conn->data->recv(conn);
|
||||
|
||||
if ((fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR)) &&
|
||||
!(conn->flags & (CO_FL_WAIT_WR|CO_FL_WAIT_DATA|CO_FL_ERROR|CO_FL_HANDSHAKE)))
|
||||
conn->app_cb->send(conn);
|
||||
conn->data->send(conn);
|
||||
|
||||
if (unlikely(conn->flags & CO_FL_ERROR))
|
||||
goto leave;
|
||||
|
@ -66,7 +66,7 @@ struct si_ops si_conn_ops = {
|
||||
.chk_snd = stream_int_chk_snd_conn,
|
||||
};
|
||||
|
||||
struct app_cb si_conn_cb = {
|
||||
struct data_cb si_conn_cb = {
|
||||
.recv = si_conn_recv_cb,
|
||||
.send = si_conn_send_cb,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user