diff --git a/include/types/connection.h b/include/types/connection.h index 52c7c7e3c..bfd6547ee 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -284,6 +284,7 @@ enum { enum { CO_RFL_BUF_WET = 0x0001, /* Buffer still has some output data present */ CO_RFL_BUF_FLUSH = 0x0002, /* Flush mux's buffers but don't read more data */ + CO_RFL_READ_ONCE = 0x0004, /* don't loop even if the request/response is small */ }; /* flags that can be passed to xprt->snd_buf() and mux->snd_buf() */ diff --git a/src/raw_sock.c b/src/raw_sock.c index 06d5f4d9e..ab03a8fd6 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -292,6 +292,9 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu } } count -= ret; + + if (flags & CO_RFL_READ_ONCE) + break; } else if (ret == 0) { goto read0;