static int si_cs_wake_cb(struct conn_stream *cs);
static int si_idle_conn_wake_cb(struct conn_stream *cs);
static void si_idle_conn_null_cb(struct conn_stream *cs);
-static struct task * si_cs_send(struct task *t, void *ctx, unsigned short state);
+static struct task * si_cs_send(struct conn_stream *cs);
/* stream-interface operations for embedded tasks */
struct si_ops si_embedded_ops = {
/* If we have data to send, try it now */
if (!channel_is_empty(oc) && objt_cs(si->end))
- si_cs_send(NULL, objt_cs(si->end), 0);
+ si_cs_send(objt_cs(si->end));
/* process consumer side */
if (channel_is_empty(oc)) {
* caller to commit polling changes. The caller should check conn->flags
* for errors.
*/
-static struct task * si_cs_send(struct task *t, void *ctx, unsigned short state)
+static struct task * si_cs_send(struct conn_stream *cs)
{
- struct conn_stream *cs = ctx;
struct connection *conn = cs->conn;
struct stream_interface *si = cs->data;
struct channel *oc = si_oc(si);
if (conn->flags & CO_FL_HANDSHAKE) {
/* a handshake was requested */
/* Schedule ourself to be woken up once the handshake is done */
- conn->xprt->subscribe(conn, SUB_CAN_SEND, wl_set_waitcb(&cs->wait_list, si_cs_send, ctx));
+ conn->xprt->subscribe(conn, SUB_CAN_SEND, wl_set_waitcb(&cs->wait_list, si_cs_io_cb, cs));
return NULL;
}
}
/* We couldn't send all of our data, let the mux know we'd like to send more */
if (co_data(oc))
- conn->mux->subscribe(cs, SUB_CAN_SEND, wl_set_waitcb(&cs->wait_list, si_cs_send, ctx));
+ conn->mux->subscribe(cs, SUB_CAN_SEND, wl_set_waitcb(&cs->wait_list, si_cs_io_cb, cs));
wake_others:
/* Maybe somebody was waiting for this conn_stream, wake them */
return NULL;
}
+struct task *si_cs_io_cb(struct task *t, void *ctx, unsigned short state)
+{
+ si_cs_send(ctx);
+ return (NULL);
+}
+
/* This function is designed to be called from within the stream handler to
* update the channels' expiration timers and the stream interface's flags
* based on the channels' flags. It needs to be called only once after the
__cs_want_send(cs);
- si_cs_send(NULL, cs, 0);
+ si_cs_send(cs);
if (cs->flags & CS_FL_ERROR || cs->conn->flags & CO_FL_ERROR) {
/* Write error on the file descriptor */
__cs_stop_both(cs);