MINOR: connection: introduce a new receive flag: CO_RFL_READ_ONCE

This flag is currently supported by raw_sock to perform a single recv()
attempt and avoid subscribing. Typically on the request and response
paths with keep-alive, with short messages we know that it's very likely
that the first message is enough.
This commit is contained in:
Willy Tarreau 2020-02-20 11:04:40 +01:00
parent 5d4d1806db
commit 716bec2dc6
2 changed files with 4 additions and 0 deletions

View File

@ -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() */

View File

@ -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;