CLEANUP: Prevent channel-t.h from being detected as C++ by GitHub

GitHub uses github/linguist to determine the programming language used for each
source file to show statistics and to power the search. In cases of unique file
extensions this is easy, but for `.h` files the situation is less clear as they
are used for C, C++, Objective C and more. In these cases linguist makes use of
heuristics to determine the language.

One of these heuristics for C++ is that the file contains a line beginning with
`try`, only preceded by whitespace indentation. This heuristic matches the long
comment at the bottom of `channel-t.h`, as one sentence includes the word `try`
after a linebreak.

Fix this misdetection by changing the comment to follow the convention that all
lines start with an asterisk.
This commit is contained in:
Tim Duesterhus 2021-06-19 16:56:30 +02:00 committed by Willy Tarreau
parent 901972e261
commit 7386668cbf

View File

@ -207,98 +207,98 @@ struct channel {
/* Note about the channel structure /* Note about the channel structure
*
A channel stores information needed to reliably transport data in a single * A channel stores information needed to reliably transport data in a single
direction. It stores status flags, timeouts, counters, subscribed analysers, * direction. It stores status flags, timeouts, counters, subscribed analysers,
pointers to a data producer and to a data consumer, and information about * pointers to a data producer and to a data consumer, and information about
the amount of data which is allowed to flow directly from the producer to * the amount of data which is allowed to flow directly from the producer to
the consumer without waking up the analysers. * the consumer without waking up the analysers.
*
A channel may buffer data into two locations : * A channel may buffer data into two locations :
- a visible buffer (->buf) * - a visible buffer (->buf)
- an invisible buffer which right now consists in a pipe making use of * - an invisible buffer which right now consists in a pipe making use of
kernel buffers that cannot be tampered with. * kernel buffers that cannot be tampered with.
*
Data stored into the first location may be analysed and altered by analysers * Data stored into the first location may be analysed and altered by analysers
while data stored in pipes is only aimed at being transported from one * while data stored in pipes is only aimed at being transported from one
network socket to another one without being subject to memory copies. This * network socket to another one without being subject to memory copies. This
buffer may only be used when both the socket layer and the data layer of the * buffer may only be used when both the socket layer and the data layer of the
producer and the consumer support it, which typically is the case with Linux * producer and the consumer support it, which typically is the case with Linux
splicing over sockets, and when there are enough data to be transported * splicing over sockets, and when there are enough data to be transported
without being analyzed (transport of TCP/HTTP payload or tunnelled data, * without being analyzed (transport of TCP/HTTP payload or tunnelled data,
which is indicated by ->to_forward). * which is indicated by ->to_forward).
*
In order not to mix data streams, the producer may only feed the invisible * In order not to mix data streams, the producer may only feed the invisible
data with data to forward, and only when the visible buffer is empty. The * data with data to forward, and only when the visible buffer is empty. The
producer may not always be able to feed the invisible buffer due to platform * producer may not always be able to feed the invisible buffer due to platform
limitations (lack of kernel support). * limitations (lack of kernel support).
*
Conversely, the consumer must always take data from the invisible data first * Conversely, the consumer must always take data from the invisible data first
before ever considering visible data. There is no limit to the size of data * before ever considering visible data. There is no limit to the size of data
to consume from the invisible buffer, as platform-specific implementations * to consume from the invisible buffer, as platform-specific implementations
will rarely leave enough control on this. So any byte fed into the invisible * will rarely leave enough control on this. So any byte fed into the invisible
buffer is expected to reach the destination file descriptor, by any means. * buffer is expected to reach the destination file descriptor, by any means.
However, it's the consumer's responsibility to ensure that the invisible * However, it's the consumer's responsibility to ensure that the invisible
data has been entirely consumed before consuming visible data. This must be * data has been entirely consumed before consuming visible data. This must be
reflected by ->pipe->data. This is very important as this and only this can * reflected by ->pipe->data. This is very important as this and only this can
ensure strict ordering of data between buffers. * ensure strict ordering of data between buffers.
*
The producer is responsible for decreasing ->to_forward. The ->to_forward * The producer is responsible for decreasing ->to_forward. The ->to_forward
parameter indicates how many bytes may be fed into either data buffer * parameter indicates how many bytes may be fed into either data buffer
without waking the parent up. The special value CHN_INFINITE_FORWARD is * without waking the parent up. The special value CHN_INFINITE_FORWARD is
never decreased nor increased. * never decreased nor increased.
*
The buf->o parameter says how many bytes may be consumed from the visible * The buf->o parameter says how many bytes may be consumed from the visible
buffer. This parameter is updated by any buffer_write() as well as any data * buffer. This parameter is updated by any buffer_write() as well as any data
forwarded through the visible buffer. Since the ->to_forward attribute * forwarded through the visible buffer. Since the ->to_forward attribute
applies to data after buf->p, an analyser will not see a buffer which has a * applies to data after buf->p, an analyser will not see a buffer which has a
non-null ->to_forward with buf->i > 0. A producer is responsible for raising * non-null ->to_forward with buf->i > 0. A producer is responsible for raising
buf->o by min(to_forward, buf->i) when it injects data into the buffer. * buf->o by min(to_forward, buf->i) when it injects data into the buffer.
*
The consumer is responsible for decreasing ->buf->o when it sends data * The consumer is responsible for decreasing ->buf->o when it sends data
from the visible buffer, and ->pipe->data when it sends data from the * from the visible buffer, and ->pipe->data when it sends data from the
invisible buffer. * invisible buffer.
*
A real-world example consists in part in an HTTP response waiting in a * A real-world example consists in part in an HTTP response waiting in a
buffer to be forwarded. We know the header length (300) and the amount of * buffer to be forwarded. We know the header length (300) and the amount of
data to forward (content-length=9000). The buffer already contains 1000 * data to forward (content-length=9000). The buffer already contains 1000
bytes of data after the 300 bytes of headers. Thus the caller will set * bytes of data after the 300 bytes of headers. Thus the caller will set
buf->o to 300 indicating that it explicitly wants to send those data, and * buf->o to 300 indicating that it explicitly wants to send those data, and
set ->to_forward to 9000 (content-length). This value must be normalised * set ->to_forward to 9000 (content-length). This value must be normalised
immediately after updating ->to_forward : since there are already 1300 bytes * immediately after updating ->to_forward : since there are already 1300 bytes
in the buffer, 300 of which are already counted in buf->o, and that size * in the buffer, 300 of which are already counted in buf->o, and that size
is smaller than ->to_forward, we must update buf->o to 1300 to flush the * is smaller than ->to_forward, we must update buf->o to 1300 to flush the
whole buffer, and reduce ->to_forward to 8000. After that, the producer may * whole buffer, and reduce ->to_forward to 8000. After that, the producer may
try to feed the additional data through the invisible buffer using a * try to feed the additional data through the invisible buffer using a
platform-specific method such as splice(). * platform-specific method such as splice().
*
The ->to_forward entry is also used to detect whether we can fill the buffer * The ->to_forward entry is also used to detect whether we can fill the buffer
or not. The idea is that we need to save some space for data manipulation * or not. The idea is that we need to save some space for data manipulation
(mainly header rewriting in HTTP) so we don't want to have a full buffer on * (mainly header rewriting in HTTP) so we don't want to have a full buffer on
input before processing a request or response. Thus, we ensure that there is * input before processing a request or response. Thus, we ensure that there is
always global.maxrewrite bytes of free space. Since we don't want to forward * always global.maxrewrite bytes of free space. Since we don't want to forward
chunks without filling the buffer, we rely on ->to_forward. When ->to_forward * chunks without filling the buffer, we rely on ->to_forward. When ->to_forward
is null, we may have some processing to do so we don't want to fill the * is null, we may have some processing to do so we don't want to fill the
buffer. When ->to_forward is non-null, we know we don't care for at least as * buffer. When ->to_forward is non-null, we know we don't care for at least as
many bytes. In the end, we know that each of the ->to_forward bytes will * many bytes. In the end, we know that each of the ->to_forward bytes will
eventually leave the buffer. So as long as ->to_forward is larger than * eventually leave the buffer. So as long as ->to_forward is larger than
global.maxrewrite, we can fill the buffer. If ->to_forward is smaller than * global.maxrewrite, we can fill the buffer. If ->to_forward is smaller than
global.maxrewrite, then we don't want to fill the buffer with more than * global.maxrewrite, then we don't want to fill the buffer with more than
buf->size - global.maxrewrite + ->to_forward. * buf->size - global.maxrewrite + ->to_forward.
*
A buffer may contain up to 5 areas : * A buffer may contain up to 5 areas :
- the data waiting to be sent. These data are located between buf->p-o and * - the data waiting to be sent. These data are located between buf->p-o and
buf->p ; * buf->p ;
- the data to process and possibly transform. These data start at * - the data to process and possibly transform. These data start at
buf->p and may be up to ->i bytes long. * buf->p and may be up to ->i bytes long.
- the data to preserve. They start at ->p and stop at ->p+i. The limit * - the data to preserve. They start at ->p and stop at ->p+i. The limit
between the two solely depends on the protocol being analysed. * between the two solely depends on the protocol being analysed.
- the spare area : it is the remainder of the buffer, which can be used to * - the spare area : it is the remainder of the buffer, which can be used to
store new incoming data. It starts at ->p+i and is up to ->size-i-o long. * store new incoming data. It starts at ->p+i and is up to ->size-i-o long.
It may be limited by global.maxrewrite. * It may be limited by global.maxrewrite.
- the reserved area : this is the area which must not be filled and is * - the reserved area : this is the area which must not be filled and is
reserved for possible rewrites ; it is up to global.maxrewrite bytes * reserved for possible rewrites ; it is up to global.maxrewrite bytes
long. * long.
*/ */
#endif /* _HAPROXY_CHANNEL_T_H */ #endif /* _HAPROXY_CHANNEL_T_H */