LIST_INIT(&cs->send_wait_list);
cs->conn = conn;
cs->rxbuf = BUF_NULL;
+ cs->txbuf = BUF_NULL;
}
/* Initializes all required fields for a new connection. Note that it does the
}
}
+/* Releases the conn_stream's tx buf if it exists. The buffer is automatically
+ * replaced with a pointer to the empty buffer.
+ */
+static inline void cs_drop_txbuf(struct conn_stream *cs)
+{
+ if (b_size(&cs->txbuf)) {
+ b_free(&cs->txbuf);
+ offer_buffers(NULL, tasks_run_queue);
+ }
+}
+
/* Releases a conn_stream previously allocated by cs_new(), as well as any
* buffer it would still hold.
*/
tasklet_free(cs->wait_list.task);
cs_drop_rxbuf(cs);
+ cs_drop_txbuf(cs);
pool_free(pool_head_connstream, cs);
}
struct wait_list wait_list; /* We're in a wait list for send */
struct list send_wait_list; /* list of tasks to wake when we're ready to send */
struct buffer rxbuf; /* receive buffer, always valid (buf_empty or real buffer) */
+ struct buffer txbuf; /* transmission buffer, always valid (buf_empty or real buffer) */
void *data; /* pointer to upper layer's entity (eg: stream interface) */
const struct data_cb *data_cb; /* data layer callbacks. Must be set before xprt->init() */
void *ctx; /* mux-specific context */