return !(c->buf->o | (long)c->pipe);
}
-/* Returns non-zero if the buffer input has all of its reserve available. This
- * is used to decide when a request or response may be parsed when some data
- * from a previous exchange might still be present.
+/* Returns non-zero if the channel is rewritable, which means that the buffer
+ * it is attached to has at least <maxrewrite> bytes immediately available.
+ * This is used to decide when a request or response may be parsed when some
+ * data from a previous exchange might still be present.
*/
-static inline int channel_reserved(const struct channel *chn)
+static inline int channel_is_rewritable(const struct channel *chn)
{
int rem = chn->buf->size;
*/
if (buffer_not_empty(req->buf) && msg->msg_state < HTTP_MSG_ERROR) {
if (txn->flags & TX_NOT_FIRST) {
- if (unlikely(!channel_reserved(req))) {
+ if (unlikely(!channel_is_rewritable(req))) {
if (req->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto failed_keep_alive;
/* some data has still not left the buffer, wake us once that's done */
* keep-alive requests.
*/
if ((txn->flags & TX_NOT_FIRST) &&
- unlikely(!channel_reserved(s->rep) ||
+ unlikely(!channel_is_rewritable(s->rep) ||
bi_end(s->rep->buf) < b_ptr(s->rep->buf, txn->rsp.next) ||
bi_end(s->rep->buf) > s->rep->buf->data + s->rep->buf->size - global.tune.maxrewrite)) {
if (s->rep->buf->o) {
* data later, which is much more complicated.
*/
if (buffer_not_empty(rep->buf) && msg->msg_state < HTTP_MSG_ERROR) {
- if (unlikely(!channel_reserved(rep))) {
+ if (unlikely(!channel_is_rewritable(rep))) {
/* some data has still not left the buffer, wake us once that's done */
if (rep->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto abort_response;