CLEANUP: channel: usr CF_/CHN_ prefixes instead of BF_/BUF_
Get rid of these confusing BF_* flags. Now channel naming should clearly
be used everywhere appropriate.
No code was changed, only a renaming was performed. The comments about
channel operations was updated.
diff --git a/include/proto/channel.h b/include/proto/channel.h
index 3c3fe4c..c6ab718 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -84,7 +84,7 @@
{
int ret = global.tune.maxrewrite - buf->to_forward - buf->buf.o;
- if (buf->to_forward == BUF_INFINITE_FORWARD)
+ if (buf->to_forward == CHN_INFINITE_FORWARD)
return 0;
if (ret <= 0)
return 0;
@@ -115,8 +115,8 @@
return 1; /* buffer already full */
if (b->to_forward >= b->buf.size ||
- (BUF_INFINITE_FORWARD < MAX_RANGE(typeof(b->buf.size)) && // just there to ensure gcc
- b->to_forward == BUF_INFINITE_FORWARD)) // avoids the useless second
+ (CHN_INFINITE_FORWARD < MAX_RANGE(typeof(b->buf.size)) && // just there to ensure gcc
+ b->to_forward == CHN_INFINITE_FORWARD)) // avoids the useless second
return 0; // test whenever possible
rem -= global.tune.maxrewrite;
@@ -141,8 +141,8 @@
return rem; /* buffer already full */
if (b->to_forward >= b->buf.size ||
- (BUF_INFINITE_FORWARD < MAX_RANGE(typeof(b->buf.size)) && // just there to ensure gcc
- b->to_forward == BUF_INFINITE_FORWARD)) // avoids the useless second
+ (CHN_INFINITE_FORWARD < MAX_RANGE(typeof(b->buf.size)) && // just there to ensure gcc
+ b->to_forward == CHN_INFINITE_FORWARD)) // avoids the useless second
return rem; // test whenever possible
rem2 = rem - global.tune.maxrewrite;
@@ -167,13 +167,13 @@
/* Returns true if the buffer's input is already closed */
static inline int buffer_input_closed(struct channel *buf)
{
- return ((buf->flags & BF_SHUTR) != 0);
+ return ((buf->flags & CF_SHUTR) != 0);
}
/* Returns true if the buffer's output is already closed */
static inline int buffer_output_closed(struct channel *buf)
{
- return ((buf->flags & BF_SHUTW) != 0);
+ return ((buf->flags & CF_SHUTW) != 0);
}
/* Check buffer timeouts, and set the corresponding flags. The
@@ -184,17 +184,17 @@
*/
static inline void buffer_check_timeouts(struct channel *b)
{
- if (likely(!(b->flags & (BF_SHUTR|BF_READ_TIMEOUT|BF_READ_ACTIVITY|BF_READ_NOEXP))) &&
+ if (likely(!(b->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_ACTIVITY|CF_READ_NOEXP))) &&
unlikely(tick_is_expired(b->rex, now_ms)))
- b->flags |= BF_READ_TIMEOUT;
+ b->flags |= CF_READ_TIMEOUT;
- if (likely(!(b->flags & (BF_SHUTW|BF_WRITE_TIMEOUT|BF_WRITE_ACTIVITY))) &&
+ if (likely(!(b->flags & (CF_SHUTW|CF_WRITE_TIMEOUT|CF_WRITE_ACTIVITY))) &&
unlikely(tick_is_expired(b->wex, now_ms)))
- b->flags |= BF_WRITE_TIMEOUT;
+ b->flags |= CF_WRITE_TIMEOUT;
- if (likely(!(b->flags & BF_ANA_TIMEOUT)) &&
+ if (likely(!(b->flags & CF_ANA_TIMEOUT)) &&
unlikely(tick_is_expired(b->analyse_exp, now_ms)))
- b->flags |= BF_ANA_TIMEOUT;
+ b->flags |= CF_ANA_TIMEOUT;
}
/* Erase any content from buffer <buf> and adjusts flags accordingly. Note
@@ -229,20 +229,20 @@
/* marks the buffer as "shutdown" ASAP for reads */
static inline void buffer_shutr_now(struct channel *buf)
{
- buf->flags |= BF_SHUTR_NOW;
+ buf->flags |= CF_SHUTR_NOW;
}
/* marks the buffer as "shutdown" ASAP for writes */
static inline void buffer_shutw_now(struct channel *buf)
{
- buf->flags |= BF_SHUTW_NOW;
+ buf->flags |= CF_SHUTW_NOW;
}
/* marks the buffer as "shutdown" ASAP in both directions */
static inline void buffer_abort(struct channel *buf)
{
- buf->flags |= BF_SHUTR_NOW | BF_SHUTW_NOW;
- buf->flags &= ~BF_AUTO_CONNECT;
+ buf->flags |= CF_SHUTR_NOW | CF_SHUTW_NOW;
+ buf->flags &= ~CF_AUTO_CONNECT;
}
/* Installs <func> as a hijacker on the buffer <b> for session <s>. The hijack
@@ -255,20 +255,20 @@
void (*func)(struct session *, struct channel *))
{
b->hijacker = func;
- b->flags |= BF_HIJACK;
+ b->flags |= CF_HIJACK;
func(s, b);
}
/* Releases the buffer from hijacking mode. Often used by the hijack function */
static inline void buffer_stop_hijack(struct channel *buf)
{
- buf->flags &= ~BF_HIJACK;
+ buf->flags &= ~CF_HIJACK;
}
/* allow the consumer to try to establish a new connection. */
static inline void buffer_auto_connect(struct channel *buf)
{
- buf->flags |= BF_AUTO_CONNECT;
+ buf->flags |= CF_AUTO_CONNECT;
}
/* prevent the consumer from trying to establish a new connection, and also
@@ -276,31 +276,31 @@
*/
static inline void buffer_dont_connect(struct channel *buf)
{
- buf->flags &= ~(BF_AUTO_CONNECT|BF_AUTO_CLOSE);
+ buf->flags &= ~(CF_AUTO_CONNECT|CF_AUTO_CLOSE);
}
/* allow the producer to forward shutdown requests */
static inline void buffer_auto_close(struct channel *buf)
{
- buf->flags |= BF_AUTO_CLOSE;
+ buf->flags |= CF_AUTO_CLOSE;
}
/* prevent the producer from forwarding shutdown requests */
static inline void buffer_dont_close(struct channel *buf)
{
- buf->flags &= ~BF_AUTO_CLOSE;
+ buf->flags &= ~CF_AUTO_CLOSE;
}
/* allow the producer to read / poll the input */
static inline void buffer_auto_read(struct channel *buf)
{
- buf->flags &= ~BF_DONT_READ;
+ buf->flags &= ~CF_DONT_READ;
}
/* prevent the producer from read / poll the input */
static inline void buffer_dont_read(struct channel *buf)
{
- buf->flags |= BF_DONT_READ;
+ buf->flags |= CF_DONT_READ;
}
/*
@@ -317,7 +317,7 @@
buf->buf.p = buf->buf.data;
/* notify that some data was written to the SI from the buffer */
- buf->flags |= BF_WRITE_PARTIAL;
+ buf->flags |= CF_WRITE_PARTIAL;
}
/* Tries to copy chunk <chunk> into buffer <buf> after length controls.
@@ -359,8 +359,8 @@
static inline int bo_getchr(struct channel *buf)
{
/* closed or empty + imminent close = -2; empty = -1 */
- if (unlikely((buf->flags & BF_SHUTW) || channel_is_empty(buf))) {
- if (buf->flags & (BF_SHUTW|BF_SHUTW_NOW))
+ if (unlikely((buf->flags & CF_SHUTW) || channel_is_empty(buf))) {
+ if (buf->flags & (CF_SHUTW|CF_SHUTW_NOW))
return -2;
return -1;
}
diff --git a/include/types/channel.h b/include/types/channel.h
index 224d0da..2ef3b3e 100644
--- a/include/types/channel.h
+++ b/include/types/channel.h
@@ -27,25 +27,25 @@
#include <common/buffer.h>
#include <types/stream_interface.h>
-/* The BF_* macros designate Channel Flags (originally "Buffer Flags"), which
- * may be ORed in the bit field member 'flags' in struct channel. Here we have
- * several types of flags :
+/* The CF_* macros designate Channel Flags, which may be ORed in the bit field
+ * member 'flags' in struct channel. Here we have several types of flags :
*
- * - pure status flags, reported by the lower layer, which must be cleared
+ * - pure status flags, reported by the data layer, which must be cleared
* before doing further I/O :
- * BF_*_NULL, BF_*_PARTIAL
+ * CF_*_NULL, CF_*_PARTIAL
*
- * - pure status flags, reported by mid-layer, which must also be cleared
- * before doing further I/O :
- * BF_*_TIMEOUT, BF_*_ERROR
+ * - pure status flags, reported by stream-interface layer, which must also
+ * be cleared before doing further I/O :
+ * CF_*_TIMEOUT, CF_*_ERROR
*
- * - read-only indicators reported by lower levels :
- * BF_STREAMER, BF_STREAMER_FAST
+ * - read-only indicators reported by lower data levels :
+ * CF_STREAMER, CF_STREAMER_FAST
*
- * - write-once status flags reported by the mid-level : BF_SHUTR, BF_SHUTW
+ * - write-once status flags reported by the stream-interface layer :
+ * CF_SHUTR, CF_SHUTW
*
- * - persistent control flags managed only by higher level :
- * BF_SHUT*_NOW, BF_*_ENA, BF_HIJACK
+ * - persistent control flags managed only by application level :
+ * CF_SHUT*_NOW, CF_*_ENA, CF_HIJACK
*
* The flags have been arranged for readability, so that the read and write
* bits have the same position in a byte (read being the lower byte and write
@@ -53,30 +53,30 @@
* 'write' indicates the direction from the channel to the stream interface.
*/
-#define BF_READ_NULL 0x000001 /* last read detected on producer side */
-#define BF_READ_PARTIAL 0x000002 /* some data were read from producer */
-#define BF_READ_TIMEOUT 0x000004 /* timeout while waiting for producer */
-#define BF_READ_ERROR 0x000008 /* unrecoverable error on producer side */
-#define BF_READ_ACTIVITY (BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR)
+#define CF_READ_NULL 0x00000001 /* last read detected on producer side */
+#define CF_READ_PARTIAL 0x00000002 /* some data were read from producer */
+#define CF_READ_TIMEOUT 0x00000004 /* timeout while waiting for producer */
+#define CF_READ_ERROR 0x00000008 /* unrecoverable error on producer side */
+#define CF_READ_ACTIVITY (CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ERROR)
-/* unused: 0x000010 */
-#define BF_SHUTR 0x000020 /* producer has already shut down */
-#define BF_SHUTR_NOW 0x000040 /* the producer must shut down for reads ASAP */
-#define BF_READ_NOEXP 0x000080 /* producer should not expire */
+/* unused: 0x00000010 */
+#define CF_SHUTR 0x00000020 /* producer has already shut down */
+#define CF_SHUTR_NOW 0x00000040 /* the producer must shut down for reads ASAP */
+#define CF_READ_NOEXP 0x00000080 /* producer should not expire */
-#define BF_WRITE_NULL 0x000100 /* write(0) or connect() succeeded on consumer side */
-#define BF_WRITE_PARTIAL 0x000200 /* some data were written to the consumer */
-#define BF_WRITE_TIMEOUT 0x000400 /* timeout while waiting for consumer */
-#define BF_WRITE_ERROR 0x000800 /* unrecoverable error on consumer side */
-#define BF_WRITE_ACTIVITY (BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_WRITE_ERROR)
+#define CF_WRITE_NULL 0x00000100 /* write(0) or connect() succeeded on consumer side */
+#define CF_WRITE_PARTIAL 0x00000200 /* some data were written to the consumer */
+#define CF_WRITE_TIMEOUT 0x00000400 /* timeout while waiting for consumer */
+#define CF_WRITE_ERROR 0x00000800 /* unrecoverable error on consumer side */
+#define CF_WRITE_ACTIVITY (CF_WRITE_NULL|CF_WRITE_PARTIAL|CF_WRITE_ERROR)
-/* unused: 0x001000 */
-#define BF_SHUTW 0x002000 /* consumer has already shut down */
-#define BF_SHUTW_NOW 0x004000 /* the consumer must shut down for writes ASAP */
-#define BF_AUTO_CLOSE 0x008000 /* producer can forward shutdown to other side */
+/* unused: 0x00001000 */
+#define CF_SHUTW 0x00002000 /* consumer has already shut down */
+#define CF_SHUTW_NOW 0x00004000 /* the consumer must shut down for writes ASAP */
+#define CF_AUTO_CLOSE 0x00008000 /* producer can forward shutdown to other side */
-/* When either BF_SHUTR_NOW or BF_HIJACK is set, it is strictly forbidden for
- * the producer to alter the buffer contents. When BF_SHUTW_NOW is set, the
+/* When either CF_SHUTR_NOW or CF_HIJACK is set, it is strictly forbidden for
+ * the producer to alter the buffer contents. When CF_SHUTW_NOW is set, the
* consumer is free to perform a shutw() when it has consumed the last contents,
* otherwise the session processor will do it anyway.
*
@@ -103,33 +103,34 @@
* detected on the consumer side.
*/
-#define BF_STREAMER 0x010000 /* the producer is identified as streaming data */
-#define BF_STREAMER_FAST 0x020000 /* the consumer seems to eat the stream very fast */
+#define CF_STREAMER 0x00010000 /* the producer is identified as streaming data */
+#define CF_STREAMER_FAST 0x00020000 /* the consumer seems to eat the stream very fast */
-#define BF_HIJACK 0x040000 /* the producer is temporarily replaced by ->hijacker */
-#define BF_ANA_TIMEOUT 0x080000 /* the analyser timeout has expired */
-#define BF_READ_ATTACHED 0x100000 /* the read side is attached for the first time */
-#define BF_KERN_SPLICING 0x200000 /* kernel splicing desired for this channel */
-#define BF_READ_DONTWAIT 0x400000 /* wake the task up after every read (eg: HTTP request) */
-#define BF_AUTO_CONNECT 0x800000 /* consumer may attempt to establish a new connection */
+#define CF_HIJACK 0x00040000 /* the producer is temporarily replaced by ->hijacker */
+#define CF_ANA_TIMEOUT 0x00080000 /* the analyser timeout has expired */
+#define CF_READ_ATTACHED 0x00100000 /* the read side is attached for the first time */
+#define CF_KERN_SPLICING 0x00200000 /* kernel splicing desired for this channel */
+#define CF_READ_DONTWAIT 0x00400000 /* wake the task up after every read (eg: HTTP request) */
+#define CF_AUTO_CONNECT 0x00800000 /* consumer may attempt to establish a new connection */
-#define BF_DONT_READ 0x1000000 /* disable reading for now */
-#define BF_EXPECT_MORE 0x2000000 /* more data expected to be sent very soon (one-shoot) */
-#define BF_SEND_DONTWAIT 0x4000000 /* don't wait for sending data (one-shoot) */
-#define BF_NEVER_WAIT 0x8000000 /* never wait for sending data (permanent) */
+#define CF_DONT_READ 0x01000000 /* disable reading for now */
+#define CF_EXPECT_MORE 0x02000000 /* more data expected to be sent very soon (one-shoot) */
+#define CF_SEND_DONTWAIT 0x04000000 /* don't wait for sending data (one-shoot) */
+#define CF_NEVER_WAIT 0x08000000 /* never wait for sending data (permanent) */
-#define BF_WAKE_ONCE 0x10000000 /* pretend there is activity on this channel (one-shoot) */
+#define CF_WAKE_ONCE 0x10000000 /* pretend there is activity on this channel (one-shoot) */
+/* unused: 0x20000000, 0x20000000, 0x80000000 */
/* Use these masks to clear the flags before going back to lower layers */
-#define BF_CLEAR_READ (~(BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR|BF_READ_ATTACHED))
-#define BF_CLEAR_WRITE (~(BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_WRITE_ERROR))
-#define BF_CLEAR_TIMEOUT (~(BF_READ_TIMEOUT|BF_WRITE_TIMEOUT|BF_ANA_TIMEOUT))
+#define CF_CLEAR_READ (~(CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ERROR|CF_READ_ATTACHED))
+#define CF_CLEAR_WRITE (~(CF_WRITE_NULL|CF_WRITE_PARTIAL|CF_WRITE_ERROR))
+#define CF_CLEAR_TIMEOUT (~(CF_READ_TIMEOUT|CF_WRITE_TIMEOUT|CF_ANA_TIMEOUT))
/* Masks which define input events for stream analysers */
-#define BF_MASK_ANALYSER (BF_READ_ATTACHED|BF_READ_ACTIVITY|BF_READ_TIMEOUT|BF_ANA_TIMEOUT|BF_WRITE_ACTIVITY|BF_WAKE_ONCE)
+#define CF_MASK_ANALYSER (CF_READ_ATTACHED|CF_READ_ACTIVITY|CF_READ_TIMEOUT|CF_ANA_TIMEOUT|CF_WRITE_ACTIVITY|CF_WAKE_ONCE)
/* Mask for static flags which cause analysers to be woken up when they change */
-#define BF_MASK_STATIC (BF_SHUTR|BF_SHUTW|BF_SHUTR_NOW|BF_SHUTW_NOW)
+#define CF_MASK_STATIC (CF_SHUTR|CF_SHUTW|CF_SHUTR_NOW|CF_SHUTW_NOW)
/* Analysers (channel->analysers).
@@ -164,13 +165,13 @@
/* Magic value to forward infinite size (TCP, ...), used with ->to_forward */
-#define BUF_INFINITE_FORWARD MAX_RANGE(int)
+#define CHN_INFINITE_FORWARD MAX_RANGE(int)
/* needed for a declaration below */
struct session;
struct channel {
- unsigned int flags; /* BF_* */
+ unsigned int flags; /* CF_* */
int rex; /* expiration date for a read, in ticks */
int wex; /* expiration date for a write or connect, in ticks */
int rto; /* read timeout, in ticks */
@@ -188,16 +189,28 @@
struct buffer buf; /* embedded buffer for now, will move */
};
+
+/* Note about the channel structure
-/* Note about the buffer structure
+ A channel stores information needed to reliably transport data in a single
+ direction. It stores status flags, timeouts, counters, subscribed analysers,
+ 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 consumer without waking up the analysers.
- The buffer contains two length indicators, one to_forward counter and one
- ->o limit. First, it must be understood that the buffer is in fact
- split in two parts :
- - the visible data (->data, for ->l bytes)
- - the invisible data, typically in kernel buffers forwarded directly from
- the source stream sock to the destination stream sock (->pipe->data
- bytes). Those are used only during forward.
+ A channel may buffer data into two locations :
+ - a visible buffer (->buf)
+ - an invisible buffer which right now consists in a pipe making use of
+ kernel buffers that cannot be tampered with.
+
+ 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
+ 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
+ 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
+ without being analyzed (transport of TCP/HTTP payload or tunnelled data,
+ which is indicated by ->to_forward).
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
@@ -214,19 +227,19 @@
reflected by ->pipe->data. This is very important as this and only this can
ensure strict ordering of data between buffers.
- The producer is responsible for decreasing ->to_forward and increasing
- ->o. The ->to_forward parameter indicates how many bytes may be fed
- into either data buffer without waking the parent up. The special value
- BUF_INFINITE_FORWARD is never decreased nor increased. The ->o
- parameter says how many bytes may be consumed from the visible buffer. Thus
- it may never exceed ->l. This parameter is updated by any buffer_write() as
- well as any data forwarded through the visible buffer. Since the ->to_forward
- attribute applies to data after ->w+o, an analyser will not see a
- buffer which has a non-null to_forward with o < l. A producer is
- responsible for raising ->o by min(to_forward, l-o) when it
- injects data into the buffer.
+ The producer is responsible for decreasing ->to_forward. The ->to_forward
+ parameter indicates how many bytes may be fed into either data buffer
+ without waking the parent up. The special value CHN_INFINITE_FORWARD is
+ never decreased nor increased.
- The consumer is responsible for decreasing ->o when it sends data
+ 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
+ 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
+ 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.
+
+ 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
invisible buffer.
@@ -234,11 +247,11 @@
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
bytes of data after the 300 bytes of headers. Thus the caller will set
- ->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
+ 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
immediately after updating ->to_forward : since there are already 1300 bytes
- in the buffer, 300 of which are already counted in ->o, and that size
- is smaller than ->to_forward, we must update ->o to 1300 to flush the
+ 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
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
platform-specific method such as splice().
@@ -255,21 +268,19 @@
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, then we don't want to fill the buffer with more than
- ->size - global.maxrewrite + ->to_forward.
+ vuf->size - global.maxrewrite + ->to_forward.
A buffer may contain up to 5 areas :
- - the data waiting to be sent. These data are located between ->w and
- ->w+o ;
+ - the data waiting to be sent. These data are located between buf->p-o and
+ buf->p ;
- the data to process and possibly transform. These data start at
- ->w+o and may be up to r-w bytes long. Generally ->lr remains in
- this area ;
- - the data to preserve. They start at the end of the previous one and stop
- at ->r. The limit between the two solely depends on the protocol being
- analysed ; ->lr may be used as a marker.
+ 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
+ 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
- store new incoming data. It starts at ->r and is up to ->size-l long. It
- may be limited by global.maxrewrite.
- - the reserved are : this is the area which must not be filled and is
+ store new incoming data. It starts at ->p+i and is up to ->size-i-o long.
+ It may be limited by global.maxrewrite.
+ - 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
long.
*/
diff --git a/src/channel.c b/src/channel.c
index 8a8e8c3..1597b0f 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -71,10 +71,10 @@
/* Note: the case below is the only case where we may return
* a byte count that does not fit into a 32-bit number.
*/
- if (likely(buf->to_forward == BUF_INFINITE_FORWARD))
+ if (likely(buf->to_forward == CHN_INFINITE_FORWARD))
return bytes;
- if (likely(bytes == BUF_INFINITE_FORWARD)) {
+ if (likely(bytes == CHN_INFINITE_FORWARD)) {
buf->to_forward = bytes;
return bytes;
}
@@ -146,10 +146,10 @@
*bi_end(&buf->buf) = c;
buf->buf.i++;
- buf->flags |= BF_READ_PARTIAL;
+ buf->flags |= CF_READ_PARTIAL;
if (buf->to_forward >= 1) {
- if (buf->to_forward != BUF_INFINITE_FORWARD)
+ if (buf->to_forward != CHN_INFINITE_FORWARD)
buf->to_forward--;
b_adv(&buf->buf, 1);
}
@@ -197,7 +197,7 @@
buf->total += len;
if (buf->to_forward) {
unsigned long fwd = len;
- if (buf->to_forward != BUF_INFINITE_FORWARD) {
+ if (buf->to_forward != CHN_INFINITE_FORWARD) {
if (fwd > buf->to_forward)
fwd = buf->to_forward;
buf->to_forward -= fwd;
@@ -206,7 +206,7 @@
}
/* notify that some data was read from the SI into the buffer */
- buf->flags |= BF_READ_PARTIAL;
+ buf->flags |= CF_READ_PARTIAL;
return len;
}
@@ -229,8 +229,8 @@
max = len;
/* closed or empty + imminent close = -1; empty = 0 */
- if (unlikely((buf->flags & BF_SHUTW) || channel_is_empty(buf))) {
- if (buf->flags & (BF_SHUTW|BF_SHUTW_NOW))
+ if (unlikely((buf->flags & CF_SHUTW) || channel_is_empty(buf))) {
+ if (buf->flags & (CF_SHUTW|CF_SHUTW_NOW))
ret = -1;
goto out;
}
@@ -252,7 +252,7 @@
}
if (ret > 0 && ret < len && ret < buf->buf.o &&
*(str-1) != '\n' &&
- !(buf->flags & (BF_SHUTW|BF_SHUTW_NOW)))
+ !(buf->flags & (CF_SHUTW|CF_SHUTW_NOW)))
ret = 0;
out:
if (max)
@@ -272,11 +272,11 @@
{
int firstblock;
- if (buf->flags & BF_SHUTW)
+ if (buf->flags & CF_SHUTW)
return -1;
if (len + offset > buf->buf.o) {
- if (buf->flags & (BF_SHUTW|BF_SHUTW_NOW))
+ if (buf->flags & (CF_SHUTW|CF_SHUTW_NOW))
return -1;
return 0;
}
diff --git a/src/dumpstats.c b/src/dumpstats.c
index f150d98..3cdba8d 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -139,7 +139,7 @@
s->logs.prx_queue_size = 0; /* we get the number of pending conns before us */
s->logs.srv_queue_size = 0; /* we will get this number soon */
- s->req->flags |= BF_READ_DONTWAIT; /* we plan to read small requests */
+ s->req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
if (s->listener->timeout) {
s->req->rto = *s->listener->timeout;
@@ -1545,10 +1545,10 @@
/* re-adjust req buffer */
bo_skip(si->ob, reql);
- req->flags |= BF_READ_DONTWAIT; /* we plan to read small requests */
+ req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
}
else { /* output functions: first check if the output buffer is closed then abort */
- if (res->flags & (BF_SHUTR_NOW|BF_SHUTR)) {
+ if (res->flags & (CF_SHUTR_NOW|CF_SHUTR)) {
si->applet.st0 = STAT_CLI_END;
continue;
}
@@ -1595,7 +1595,7 @@
* buffer is empty. This still allows pipelined requests
* to be sent in non-interactive mode.
*/
- if ((res->flags & (BF_SHUTW|BF_SHUTW_NOW)) || (!si->applet.st1 && !req->buf.o)) {
+ if ((res->flags & (CF_SHUTW|CF_SHUTW_NOW)) || (!si->applet.st1 && !req->buf.o)) {
si->applet.st0 = STAT_CLI_END;
continue;
}
@@ -1605,7 +1605,7 @@
}
}
- if ((res->flags & BF_SHUTR) && (si->state == SI_ST_EST) && (si->applet.st0 != STAT_CLI_GETREQ)) {
+ if ((res->flags & CF_SHUTR) && (si->state == SI_ST_EST) && (si->applet.st0 != STAT_CLI_GETREQ)) {
DPRINTF(stderr, "%s@%d: si to buf closed. req=%08x, res=%08x, st=%d\n",
__FUNCTION__, __LINE__, req->flags, res->flags, si->state);
/* Other side has closed, let's abort if we have no more processing to do
@@ -1616,7 +1616,7 @@
si_shutw(si);
}
- if ((req->flags & BF_SHUTW) && (si->state == SI_ST_EST) && (si->applet.st0 < STAT_CLI_OUTPUT)) {
+ if ((req->flags & CF_SHUTW) && (si->state == SI_ST_EST) && (si->applet.st0 < STAT_CLI_OUTPUT)) {
DPRINTF(stderr, "%s@%d: buf to si closed. req=%08x, res=%08x, st=%d\n",
__FUNCTION__, __LINE__, req->flags, res->flags, si->state);
/* We have no more processing to do, and nothing more to send, and
@@ -1624,7 +1624,7 @@
* on the response buffer.
*/
si_shutr(si);
- res->flags |= BF_READ_NULL;
+ res->flags |= CF_READ_NULL;
}
/* update all other flags and resync with the other side */
@@ -1823,7 +1823,7 @@
goto out;
/* check that the output is not closed */
- if (res->flags & (BF_SHUTW|BF_SHUTW_NOW))
+ if (res->flags & (CF_SHUTW|CF_SHUTW_NOW))
si->applet.st0 = 1;
if (!si->applet.st0) {
@@ -1840,12 +1840,12 @@
}
}
- if ((res->flags & BF_SHUTR) && (si->state == SI_ST_EST))
+ if ((res->flags & CF_SHUTR) && (si->state == SI_ST_EST))
si_shutw(si);
- if ((req->flags & BF_SHUTW) && (si->state == SI_ST_EST) && si->applet.st0) {
+ if ((req->flags & CF_SHUTW) && (si->state == SI_ST_EST) && si->applet.st0) {
si_shutr(si);
- res->flags |= BF_READ_NULL;
+ res->flags |= CF_READ_NULL;
}
/* update all other flags and resync with the other side */
@@ -3545,7 +3545,7 @@
{
struct chunk msg;
- if (unlikely(si->ib->flags & (BF_WRITE_ERROR|BF_SHUTW))) {
+ if (unlikely(si->ib->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
/* If we're forced to shut down, we might have to remove our
* reference to the last session being dumped.
*/
@@ -3770,7 +3770,7 @@
* data though.
*/
- if (unlikely(si->ib->flags & (BF_WRITE_ERROR|BF_SHUTW))) {
+ if (unlikely(si->ib->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
/* in case of abort, remove any refcount we might have set on an entry */
if (si->conn.data_st == STAT_ST_LIST) {
si->applet.ctx.table.entry->ref_cnt--;
@@ -3971,7 +3971,7 @@
extern const char *monthname[12];
struct chunk msg;
- if (unlikely(si->ib->flags & (BF_WRITE_ERROR|BF_SHUTW)))
+ if (unlikely(si->ib->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
chunk_init(&msg, trash, trashlen);
diff --git a/src/frontend.c b/src/frontend.c
index ffd1017..07c4462 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -186,7 +186,7 @@
}
if (s->fe->mode == PR_MODE_HTTP)
- s->req->flags |= BF_READ_DONTWAIT; /* one read is usually enough */
+ s->req->flags |= CF_READ_DONTWAIT; /* one read is usually enough */
/* note: this should not happen anymore since there's always at least the switching rules */
if (!s->req->analysers) {
@@ -266,7 +266,7 @@
req->i,
req->analysers);
- if (req->flags & (BF_READ_ERROR|BF_READ_TIMEOUT))
+ if (req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT))
goto fail;
len = MIN(req->buf.i, 6);
@@ -397,7 +397,7 @@
missing:
/* missing data and buffer is either full or shutdown => fail */
- if ((req->flags & BF_SHUTR) || buffer_full(&req->buf, global.tune.maxrewrite))
+ if ((req->flags & CF_SHUTR) || buffer_full(&req->buf, global.tune.maxrewrite))
goto fail;
buffer_dont_connect(s->req);
diff --git a/src/peers.c b/src/peers.c
index 894502a..386cca9 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -525,7 +525,7 @@
case PEER_SESSION_GETSTATUS: {
struct peer_session *ps = (struct peer_session *)si->conn.data_ctx;
- if (si->ib->flags & BF_WRITE_PARTIAL)
+ if (si->ib->flags & CF_WRITE_PARTIAL)
ps->statuscode = PEER_SESSION_CONNECTEDCODE;
reql = bo_getline(si->ob, trash, trashlen);
@@ -1024,14 +1024,14 @@
case PEER_SESSION_END: {
si_shutw(si);
si_shutr(si);
- si->ib->flags |= BF_READ_NULL;
+ si->ib->flags |= CF_READ_NULL;
goto quit;
}
}
}
out:
si_update(si);
- si->ob->flags |= BF_READ_DONTWAIT;
+ si->ob->flags |= CF_READ_DONTWAIT;
/* we don't want to expire timeouts while we're processing requests */
si->ib->rex = TICK_ETERNITY;
si->ob->wex = TICK_ETERNITY;
@@ -1090,7 +1090,7 @@
s->logs.prx_queue_size = 0;/* we get the number of pending conns before us */
s->logs.srv_queue_size = 0; /* we will get this number soon */
- s->req->flags |= BF_READ_DONTWAIT; /* we plan to read small requests */
+ s->req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
if (s->listener->timeout) {
s->req->rto = *s->listener->timeout;
@@ -1231,7 +1231,7 @@
s->req->cons = &s->si[1];
s->si[0].ib = s->si[1].ob = s->req;
- s->req->flags |= BF_READ_ATTACHED; /* the producer is already connected */
+ s->req->flags |= CF_READ_ATTACHED; /* the producer is already connected */
/* activate default analysers enabled for this listener */
s->req->analysers = l->analysers;
@@ -1265,7 +1265,7 @@
s->rep->analyse_exp = TICK_ETERNITY;
t->expire = TICK_ETERNITY;
- s->rep->flags |= BF_READ_DONTWAIT;
+ s->rep->flags |= CF_READ_DONTWAIT;
/* it is important not to call the wakeup function directly but to
* pass through task_wakeup(), because this one knows how to apply
* priorities to tasks.
diff --git a/src/proto_http.c b/src/proto_http.c
index a047bc1..ce462e1 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2023,11 +2023,11 @@
bi_end(&req->buf) < b_ptr(&req->buf, msg->next) ||
bi_end(&req->buf) > req->buf.data + req->buf.size - global.tune.maxrewrite)) {
if (req->buf.o) {
- if (req->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_WRITE_ERROR|BF_WRITE_TIMEOUT))
+ 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 */
buffer_dont_connect(req);
- req->flags |= BF_READ_DONTWAIT; /* try to get back here ASAP */
+ req->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
return 0;
}
if (bi_end(&req->buf) < b_ptr(&req->buf, msg->next) ||
@@ -2047,11 +2047,11 @@
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) {
- if (s->rep->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_WRITE_ERROR|BF_WRITE_TIMEOUT))
+ if (s->rep->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto failed_keep_alive;
/* don't let a connection request be initiated */
buffer_dont_connect(req);
- s->rep->flags &= ~BF_EXPECT_MORE; /* speed up sending a previous response */
+ s->rep->flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
s->rep->analysers |= an_bit; /* wake us up once it changes */
return 0;
}
@@ -2128,7 +2128,7 @@
}
/* 2: have we encountered a read error ? */
- else if (req->flags & BF_READ_ERROR) {
+ else if (req->flags & CF_READ_ERROR) {
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_CLICL;
@@ -2156,7 +2156,7 @@
}
/* 3: has the read timeout expired ? */
- else if (req->flags & BF_READ_TIMEOUT || tick_is_expired(req->analyse_exp, now_ms)) {
+ else if (req->flags & CF_READ_TIMEOUT || tick_is_expired(req->analyse_exp, now_ms)) {
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_CLITO;
@@ -2185,7 +2185,7 @@
}
/* 4: have we encountered a close ? */
- else if (req->flags & BF_SHUTR) {
+ else if (req->flags & CF_SHUTR) {
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_CLICL;
@@ -2212,8 +2212,8 @@
}
buffer_dont_connect(req);
- req->flags |= BF_READ_DONTWAIT; /* try to get back here ASAP */
- s->rep->flags &= ~BF_EXPECT_MORE; /* speed up sending a previous response */
+ req->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
+ s->rep->flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
#ifdef TCP_QUICKACK
if (s->listener->options & LI_O_NOQUICKACK && req->buf.i) {
/* We need more data, we have to re-enable quick-ack in case we
@@ -2255,7 +2255,7 @@
msg->msg_state = HTTP_MSG_RQBEFORE;
req->analysers = 0;
s->logs.logwait = 0;
- s->rep->flags &= ~BF_EXPECT_MORE; /* speed up sending a previous response */
+ s->rep->flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
stream_int_retnclose(req->prod, NULL);
return 0;
}
@@ -3196,10 +3196,10 @@
* If this happens, then the data will not come immediately, so we must
* send all what we have without waiting. Note that due to the small gain
* in waiting for the body of the request, it's easier to simply put the
- * BF_SEND_DONTWAIT flag any time. It's a one-shot flag so it will remove
+ * CF_SEND_DONTWAIT flag any time. It's a one-shot flag so it will remove
* itself once used.
*/
- req->flags |= BF_SEND_DONTWAIT;
+ req->flags |= CF_SEND_DONTWAIT;
/* that's OK for us now, let's move on to next analysers */
return 1;
@@ -3527,7 +3527,7 @@
* there and that the timeout has not expired.
*/
buffer_dont_connect(req);
- if ((req->flags & (BF_SHUTR|BF_READ_ERROR)) == 0 &&
+ if ((req->flags & (CF_SHUTR|CF_READ_ERROR)) == 0 &&
!tick_is_expired(req->analyse_exp, now_ms))
return 0;
@@ -3540,7 +3540,7 @@
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
txn->status = 500;
- if (!(req->flags & BF_READ_ERROR))
+ if (!(req->flags & CF_READ_ERROR))
stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_500));
req->analysers = 0;
@@ -3641,7 +3641,7 @@
goto return_bad_req;
}
- if ((req->flags & BF_READ_TIMEOUT) || tick_is_expired(req->analyse_exp, now_ms)) {
+ if ((req->flags & CF_READ_TIMEOUT) || tick_is_expired(req->analyse_exp, now_ms)) {
txn->status = 408;
stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_408));
@@ -3653,7 +3653,7 @@
}
/* we get here if we need to wait for more data */
- if (!(req->flags & (BF_SHUTR | BF_READ_ERROR)) && !buffer_full(&req->buf, global.tune.maxrewrite)) {
+ if (!(req->flags & (CF_SHUTR | CF_READ_ERROR)) && !buffer_full(&req->buf, global.tune.maxrewrite)) {
/* Not enough data. We'll re-use the http-request
* timeout here. Ideally, we should set the timeout
* relative to the accept() date. We just set the
@@ -3829,8 +3829,8 @@
s->req->cons->err_loc = NULL;
s->req->cons->exp = TICK_ETERNITY;
s->req->cons->flags = SI_FL_NONE;
- s->req->flags &= ~(BF_SHUTW|BF_SHUTW_NOW|BF_AUTO_CONNECT|BF_WRITE_ERROR|BF_STREAMER|BF_STREAMER_FAST|BF_NEVER_WAIT);
- s->rep->flags &= ~(BF_SHUTR|BF_SHUTR_NOW|BF_READ_ATTACHED|BF_READ_ERROR|BF_READ_NOEXP|BF_STREAMER|BF_STREAMER_FAST|BF_WRITE_PARTIAL|BF_NEVER_WAIT);
+ s->req->flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT);
+ s->rep->flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT);
s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST);
s->flags &= ~(SN_CURR_SESS|SN_REDIRECTABLE);
s->txn.meth = 0;
@@ -3840,8 +3840,8 @@
s->req->cons->flags |= SI_FL_INDEP_STR;
if (s->fe->options2 & PR_O2_NODELAY) {
- s->req->flags |= BF_NEVER_WAIT;
- s->rep->flags |= BF_NEVER_WAIT;
+ s->req->flags |= CF_NEVER_WAIT;
+ s->rep->flags |= CF_NEVER_WAIT;
}
/* if the request buffer is not empty, it means we're
@@ -3855,7 +3855,7 @@
if (s->rep->buf.o &&
!buffer_full(&s->rep->buf, global.tune.maxrewrite) &&
bi_end(&s->rep->buf) <= s->rep->buf.data + s->rep->buf.size - global.tune.maxrewrite)
- s->rep->flags |= BF_EXPECT_MORE;
+ s->rep->flags |= CF_EXPECT_MORE;
}
/* we're removing the analysers, we MUST re-enable events detection */
@@ -3927,7 +3927,7 @@
if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL) {
/* Server-close mode : queue a connection close to the server */
- if (!(buf->flags & (BF_SHUTW|BF_SHUTW_NOW)))
+ if (!(buf->flags & (CF_SHUTW|CF_SHUTW_NOW)))
buffer_shutw_now(buf);
}
else if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_CLO) {
@@ -3936,7 +3936,7 @@
* data to come. The caller knows the session is complete
* once both states are CLOSED.
*/
- if (!(buf->flags & (BF_SHUTW|BF_SHUTW_NOW))) {
+ if (!(buf->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
buffer_shutr_now(buf);
buffer_shutw_now(buf);
}
@@ -3951,7 +3951,7 @@
txn->req.msg_state = HTTP_MSG_TUNNEL;
}
- if (buf->flags & (BF_SHUTW|BF_SHUTW_NOW)) {
+ if (buf->flags & (CF_SHUTW|CF_SHUTW_NOW)) {
/* if we've just closed an output, let's switch */
buf->cons->flags |= SI_FL_NOLINGER; /* we want to close ASAP */
@@ -3976,7 +3976,7 @@
txn->req.msg_state = HTTP_MSG_CLOSED;
goto http_msg_closed;
}
- else if (buf->flags & BF_SHUTW) {
+ else if (buf->flags & CF_SHUTW) {
txn->req.msg_state = HTTP_MSG_ERROR;
goto wait_other_side;
}
@@ -4050,7 +4050,7 @@
* when we're in DONE and the other is in CLOSED and will
* catch that for the final cleanup.
*/
- if (!(buf->flags & (BF_SHUTR|BF_SHUTR_NOW)))
+ if (!(buf->flags & (CF_SHUTR|CF_SHUTR_NOW)))
buffer_shutr_now(buf);
}
else if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_CLO) {
@@ -4059,7 +4059,7 @@
* data to come. The caller knows the session is complete
* once both states are CLOSED.
*/
- if (!(buf->flags & (BF_SHUTW|BF_SHUTW_NOW))) {
+ if (!(buf->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
buffer_shutr_now(buf);
buffer_shutw_now(buf);
}
@@ -4074,7 +4074,7 @@
txn->rsp.msg_state = HTTP_MSG_TUNNEL;
}
- if (buf->flags & (BF_SHUTW|BF_SHUTW_NOW)) {
+ if (buf->flags & (CF_SHUTW|CF_SHUTW_NOW)) {
/* if we've just closed an output, let's switch */
if (!channel_is_empty(buf)) {
txn->rsp.msg_state = HTTP_MSG_CLOSING;
@@ -4097,7 +4097,7 @@
txn->rsp.msg_state = HTTP_MSG_CLOSED;
goto http_msg_closed;
}
- else if (buf->flags & BF_SHUTW) {
+ else if (buf->flags & CF_SHUTW) {
txn->rsp.msg_state = HTTP_MSG_ERROR;
s->be->be_counters.cli_aborts++;
if (target_srv(&s->target))
@@ -4167,7 +4167,7 @@
else if (txn->rsp.msg_state == HTTP_MSG_CLOSED ||
txn->rsp.msg_state == HTTP_MSG_ERROR ||
txn->req.msg_state == HTTP_MSG_ERROR ||
- (s->rep->flags & BF_SHUTW)) {
+ (s->rep->flags & CF_SHUTW)) {
s->rep->analysers = 0;
buffer_auto_close(s->rep);
buffer_auto_read(s->rep);
@@ -4210,8 +4210,8 @@
if (unlikely(msg->msg_state < HTTP_MSG_BODY))
return 0;
- if ((req->flags & (BF_READ_ERROR|BF_READ_TIMEOUT|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) ||
- ((req->flags & BF_SHUTW) && (req->to_forward || req->buf.o))) {
+ if ((req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) ||
+ ((req->flags & CF_SHUTW) && (req->to_forward || req->buf.o))) {
/* Output closed while we were sending data. We must abort and
* wake the other side up.
*/
@@ -4327,7 +4327,7 @@
* was disabled too.
*/
if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) {
- if (req->flags & BF_SHUTW) {
+ if (req->flags & CF_SHUTW) {
/* request errors are most likely due to
* the server aborting the transfer.
*/
@@ -4365,7 +4365,7 @@
missing_data:
/* stop waiting for data if the input is closed before the end */
- if (req->flags & BF_SHUTR) {
+ if (req->flags & CF_SHUTR) {
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_CLICL;
if (!(s->flags & SN_FINST_MASK)) {
@@ -4384,17 +4384,17 @@
}
/* waiting for the last bits to leave the buffer */
- if (req->flags & BF_SHUTW)
+ if (req->flags & CF_SHUTW)
goto aborted_xfer;
/* When TE: chunked is used, we need to get there again to parse remaining
- * chunks even if the client has closed, so we don't want to set BF_DONTCLOSE.
+ * chunks even if the client has closed, so we don't want to set CF_DONTCLOSE.
*/
if (msg->flags & HTTP_MSGF_TE_CHNK)
buffer_dont_close(req);
/* We know that more data are expected, but we couldn't send more that
- * what we did. So we always set the BF_EXPECT_MORE flag so that the
+ * what we did. So we always set the CF_EXPECT_MORE flag so that the
* system knows it must not set a PUSH on this first part. Interactive
* modes are already handled by the stream sock layer. We must not do
* this in content-length mode because it could present the MSG_MORE
@@ -4402,7 +4402,7 @@
* additional delay to be observed by the receiver.
*/
if (msg->flags & HTTP_MSGF_TE_CHNK)
- req->flags |= BF_EXPECT_MORE;
+ req->flags |= CF_EXPECT_MORE;
http_silent_debug(__LINE__, s);
return 0;
@@ -4513,10 +4513,10 @@
bi_end(&rep->buf) > rep->buf.data + rep->buf.size - global.tune.maxrewrite)) {
if (rep->buf.o) {
/* some data has still not left the buffer, wake us once that's done */
- if (rep->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_WRITE_ERROR|BF_WRITE_TIMEOUT))
+ if (rep->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto abort_response;
buffer_dont_close(rep);
- rep->flags |= BF_READ_DONTWAIT; /* try to get back here ASAP */
+ rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
return 0;
}
if (rep->buf.i <= rep->buf.size - global.tune.maxrewrite)
@@ -4600,7 +4600,7 @@
}
/* read error */
- else if (rep->flags & BF_READ_ERROR) {
+ else if (rep->flags & CF_READ_ERROR) {
if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
@@ -4625,7 +4625,7 @@
}
/* read timeout : return a 504 to the client. */
- else if (rep->flags & BF_READ_TIMEOUT) {
+ else if (rep->flags & CF_READ_TIMEOUT) {
if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
@@ -4650,7 +4650,7 @@
}
/* close from server, capture the response if the server has started to respond */
- else if (rep->flags & BF_SHUTR) {
+ else if (rep->flags & CF_SHUTR) {
if (msg->msg_state >= HTTP_MSG_RPVER || msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
@@ -4675,7 +4675,7 @@
}
/* write error to client (we don't send any message then) */
- else if (rep->flags & BF_WRITE_ERROR) {
+ else if (rep->flags & CF_WRITE_ERROR) {
if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
@@ -5278,8 +5278,8 @@
if (unlikely(msg->msg_state < HTTP_MSG_BODY))
return 0;
- if ((res->flags & (BF_READ_ERROR|BF_READ_TIMEOUT|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) ||
- ((res->flags & BF_SHUTW) && (res->to_forward || res->buf.o)) ||
+ if ((res->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) ||
+ ((res->flags & CF_SHUTW) && (res->to_forward || res->buf.o)) ||
!s->req->analysers) {
/* Output closed while we were sending data. We must abort and
* wake the other side up.
@@ -5386,7 +5386,7 @@
* was disabled too.
*/
if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) {
- if (res->flags & BF_SHUTW) {
+ if (res->flags & CF_SHUTW) {
/* response errors are most likely due to
* the client aborting the transfer.
*/
@@ -5404,7 +5404,7 @@
missing_data:
/* stop waiting for data if the input is closed before the end */
- if (res->flags & BF_SHUTR) {
+ if (res->flags & CF_SHUTR) {
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_SRVCL;
s->be->be_counters.srv_aborts++;
@@ -5413,7 +5413,7 @@
goto return_bad_res_stats_ok;
}
- if (res->flags & BF_SHUTW)
+ if (res->flags & CF_SHUTW)
goto aborted_xfer;
/* we need to obey the req analyser, so if it leaves, we must too */
@@ -5430,7 +5430,7 @@
}
/* When TE: chunked is used, we need to get there again to parse remaining
- * chunks even if the server has closed, so we don't want to set BF_DONTCLOSE.
+ * chunks even if the server has closed, so we don't want to set CF_DONTCLOSE.
* Similarly, with keep-alive on the client side, we don't want to forward a
* close.
*/
@@ -5440,7 +5440,7 @@
buffer_dont_close(res);
/* We know that more data are expected, but we couldn't send more that
- * what we did. So we always set the BF_EXPECT_MORE flag so that the
+ * what we did. So we always set the CF_EXPECT_MORE flag so that the
* system knows it must not set a PUSH on this first part. Interactive
* modes are already handled by the stream sock layer. We must not do
* this in content-length mode because it could present the MSG_MORE
@@ -5448,7 +5448,7 @@
* additional delay to be observed by the receiver.
*/
if (msg->flags & HTTP_MSGF_TE_CHNK)
- res->flags |= BF_EXPECT_MORE;
+ res->flags |= CF_EXPECT_MORE;
/* the session handler will take care of timeouts and errors */
http_silent_debug(__LINE__, s);
@@ -7469,7 +7469,7 @@
s->pend_pos = NULL;
- s->req->flags |= BF_READ_DONTWAIT; /* one read is usually enough */
+ s->req->flags |= CF_READ_DONTWAIT; /* one read is usually enough */
/* We must trim any excess data from the response buffer, because we
* may have blocked an invalid response from a server that we don't
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 05f09a1..22664dd 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -809,7 +809,7 @@
* - if one rule returns KO, then return KO
*/
- if ((req->flags & BF_SHUTR) || buffer_full(&req->buf, global.tune.maxrewrite) ||
+ if ((req->flags & CF_SHUTR) || buffer_full(&req->buf, global.tune.maxrewrite) ||
!s->be->tcp_req.inspect_delay || tick_is_expired(req->analyse_exp, now_ms))
partial = SMP_OPT_FINAL;
else
@@ -928,7 +928,7 @@
* - if one rule returns KO, then return KO
*/
- if (rep->flags & BF_SHUTR || tick_is_expired(rep->analyse_exp, now_ms))
+ if (rep->flags & CF_SHUTR || tick_is_expired(rep->analyse_exp, now_ms))
partial = SMP_OPT_FINAL;
else
partial = 0;
diff --git a/src/proxy.c b/src/proxy.c
index 3568251..6e1f6e5 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -830,8 +830,8 @@
}
if (be->options2 & PR_O2_NODELAY) {
- s->req->flags |= BF_NEVER_WAIT;
- s->rep->flags |= BF_NEVER_WAIT;
+ s->req->flags |= CF_NEVER_WAIT;
+ s->rep->flags |= CF_NEVER_WAIT;
}
/* We want to enable the backend-specific analysers except those which
diff --git a/src/session.c b/src/session.c
index ab9cd5a..a62b42a 100644
--- a/src/session.c
+++ b/src/session.c
@@ -229,7 +229,7 @@
s->req->prod = &s->si[0];
s->req->cons = &s->si[1];
s->si[0].ib = s->si[1].ob = s->req;
- s->req->flags |= BF_READ_ATTACHED; /* the producer is already connected */
+ s->req->flags |= CF_READ_ATTACHED; /* the producer is already connected */
/* activate default analysers enabled for this listener */
s->req->analysers = l->analysers;
@@ -249,8 +249,8 @@
s->rep->analysers = 0;
if (s->fe->options2 & PR_O2_NODELAY) {
- s->req->flags |= BF_NEVER_WAIT;
- s->rep->flags |= BF_NEVER_WAIT;
+ s->req->flags |= CF_NEVER_WAIT;
+ s->rep->flags |= CF_NEVER_WAIT;
}
s->rep->rto = TICK_ETERNITY;
@@ -561,9 +561,9 @@
}
/* OK, maybe we want to abort */
- if (unlikely((rep->flags & BF_SHUTW) ||
- ((req->flags & BF_SHUTW_NOW) && /* FIXME: this should not prevent a connection from establishing */
- ((!(req->flags & BF_WRITE_ACTIVITY) && channel_is_empty(req)) ||
+ if (unlikely((rep->flags & CF_SHUTW) ||
+ ((req->flags & CF_SHUTW_NOW) && /* FIXME: this should not prevent a connection from establishing */
+ ((!(req->flags & CF_WRITE_ACTIVITY) && channel_is_empty(req)) ||
s->be->options & PR_O_ABRT_CLOSE)))) {
/* give up */
si_shutw(si);
@@ -576,7 +576,7 @@
}
/* we need to wait a bit more if there was no activity either */
- if (!(req->flags & BF_WRITE_ACTIVITY))
+ if (!(req->flags & CF_WRITE_ACTIVITY))
return 1;
/* OK, this means that a connection succeeded. The caller will be
@@ -628,8 +628,8 @@
/* shutw is enough so stop a connecting socket */
si_shutw(si);
- si->ob->flags |= BF_WRITE_ERROR;
- si->ib->flags |= BF_READ_ERROR;
+ si->ob->flags |= CF_WRITE_ERROR;
+ si->ib->flags |= CF_READ_ERROR;
si->state = SI_ST_CLO;
if (s->srv_error)
@@ -705,7 +705,7 @@
}
rep->analysers |= s->fe->fe_rsp_ana | s->be->be_rsp_ana;
- rep->flags |= BF_READ_ATTACHED; /* producer is now attached */
+ rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
if (si_ctrl(si)) {
/* real connections have timeouts */
req->wto = s->be->timeout.server;
@@ -768,7 +768,7 @@
/* Failed and not retryable. */
si_shutr(si);
si_shutw(si);
- si->ob->flags |= BF_WRITE_ERROR;
+ si->ob->flags |= CF_WRITE_ERROR;
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
@@ -817,7 +817,7 @@
s->be->be_counters.failed_conns++;
si_shutr(si);
si_shutw(si);
- si->ob->flags |= BF_WRITE_TIMEOUT;
+ si->ob->flags |= CF_WRITE_TIMEOUT;
if (!si->err_type)
si->err_type = SI_ET_QUEUE_TO;
si->state = SI_ST_CLO;
@@ -827,8 +827,8 @@
}
/* Connection remains in queue, check if we have to abort it */
- if ((si->ob->flags & (BF_READ_ERROR)) ||
- ((si->ob->flags & BF_SHUTW_NOW) && /* empty and client aborted */
+ if ((si->ob->flags & (CF_READ_ERROR)) ||
+ ((si->ob->flags & CF_SHUTW_NOW) && /* empty and client aborted */
(channel_is_empty(si->ob) || s->be->options & PR_O_ABRT_CLOSE))) {
/* give up */
si->exp = TICK_ETERNITY;
@@ -847,8 +847,8 @@
}
else if (si->state == SI_ST_TAR) {
/* Connection request might be aborted */
- if ((si->ob->flags & (BF_READ_ERROR)) ||
- ((si->ob->flags & BF_SHUTW_NOW) && /* empty and client aborted */
+ if ((si->ob->flags & (CF_READ_ERROR)) ||
+ ((si->ob->flags & CF_SHUTW_NOW) && /* empty and client aborted */
(channel_is_empty(si->ob) || s->be->options & PR_O_ABRT_CLOSE))) {
/* give up */
si->exp = TICK_ETERNITY;
@@ -933,7 +933,7 @@
/* we did not get any server, let's check the cause */
si_shutr(si);
si_shutw(si);
- si->ob->flags |= BF_WRITE_ERROR;
+ si->ob->flags |= CF_WRITE_ERROR;
if (!si->err_type)
si->err_type = SI_ET_CONN_OTHER;
si->state = SI_ST_CLO;
@@ -1316,11 +1316,11 @@
memset(&s->txn.auth, 0, sizeof(s->txn.auth));
/* This flag must explicitly be set every time */
- s->req->flags &= ~BF_READ_NOEXP;
+ s->req->flags &= ~CF_READ_NOEXP;
/* Keep a copy of req/rep flags so that we can detect shutdowns */
- rqf_last = s->req->flags & ~BF_MASK_ANALYSER;
- rpf_last = s->rep->flags & ~BF_MASK_ANALYSER;
+ rqf_last = s->req->flags & ~CF_MASK_ANALYSER;
+ rpf_last = s->rep->flags & ~CF_MASK_ANALYSER;
/* we don't want the stream interface functions to recursively wake us up */
if (s->req->prod->owner == t)
@@ -1343,12 +1343,12 @@
buffer_check_timeouts(s->req);
- if (unlikely((s->req->flags & (BF_SHUTW|BF_WRITE_TIMEOUT)) == BF_WRITE_TIMEOUT)) {
+ if (unlikely((s->req->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) {
s->req->cons->flags |= SI_FL_NOLINGER;
si_shutw(s->req->cons);
}
- if (unlikely((s->req->flags & (BF_SHUTR|BF_READ_TIMEOUT)) == BF_READ_TIMEOUT)) {
+ if (unlikely((s->req->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) {
if (s->req->prod->flags & SI_FL_NOHALF)
s->req->prod->flags |= SI_FL_NOLINGER;
si_shutr(s->req->prod);
@@ -1356,12 +1356,12 @@
buffer_check_timeouts(s->rep);
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_WRITE_TIMEOUT)) == BF_WRITE_TIMEOUT)) {
+ if (unlikely((s->rep->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) {
s->rep->cons->flags |= SI_FL_NOLINGER;
si_shutw(s->rep->cons);
}
- if (unlikely((s->rep->flags & (BF_SHUTR|BF_READ_TIMEOUT)) == BF_READ_TIMEOUT)) {
+ if (unlikely((s->rep->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) {
if (s->rep->prod->flags & SI_FL_NOHALF)
s->rep->prod->flags |= SI_FL_NOLINGER;
si_shutr(s->rep->prod);
@@ -1479,8 +1479,8 @@
resync_request:
/* Analyse request */
- if (((s->req->flags & ~rqf_last) & BF_MASK_ANALYSER) ||
- ((s->req->flags ^ rqf_last) & BF_MASK_STATIC) ||
+ if (((s->req->flags & ~rqf_last) & CF_MASK_ANALYSER) ||
+ ((s->req->flags ^ rqf_last) & CF_MASK_STATIC) ||
s->si[0].state != rq_prod_last ||
s->si[1].state != rq_cons_last) {
unsigned int flags = s->req->flags;
@@ -1627,10 +1627,10 @@
rq_prod_last = s->si[0].state;
rq_cons_last = s->si[1].state;
- s->req->flags &= ~BF_WAKE_ONCE;
+ s->req->flags &= ~CF_WAKE_ONCE;
rqf_last = s->req->flags;
- if ((s->req->flags ^ flags) & BF_MASK_STATIC)
+ if ((s->req->flags ^ flags) & CF_MASK_STATIC)
goto resync_request;
}
@@ -1643,29 +1643,29 @@
resync_response:
/* Analyse response */
- if (unlikely(s->rep->flags & BF_HIJACK)) {
+ if (unlikely(s->rep->flags & CF_HIJACK)) {
/* In inject mode, we wake up everytime something has
* happened on the write side of the buffer.
*/
unsigned int flags = s->rep->flags;
- if ((s->rep->flags & (BF_WRITE_PARTIAL|BF_WRITE_ERROR|BF_SHUTW)) &&
+ if ((s->rep->flags & (CF_WRITE_PARTIAL|CF_WRITE_ERROR|CF_SHUTW)) &&
!channel_full(s->rep)) {
s->rep->hijacker(s, s->rep);
}
- if ((s->rep->flags ^ flags) & BF_MASK_STATIC) {
+ if ((s->rep->flags ^ flags) & CF_MASK_STATIC) {
rpf_last = s->rep->flags;
goto resync_response;
}
}
- else if (((s->rep->flags & ~rpf_last) & BF_MASK_ANALYSER) ||
- (s->rep->flags ^ rpf_last) & BF_MASK_STATIC ||
+ else if (((s->rep->flags & ~rpf_last) & CF_MASK_ANALYSER) ||
+ (s->rep->flags ^ rpf_last) & CF_MASK_STATIC ||
s->si[0].state != rp_cons_last ||
s->si[1].state != rp_prod_last) {
unsigned int flags = s->rep->flags;
- if ((s->rep->flags & BF_MASK_ANALYSER) &&
+ if ((s->rep->flags & CF_MASK_ANALYSER) &&
(s->rep->analysers & AN_REQ_WAIT_HTTP)) {
/* Due to HTTP pipelining, the HTTP request analyser might be waiting
* for some free space in the response buffer, so we might need to call
@@ -1674,7 +1674,7 @@
* be zero due to us returning a flow of redirects!
*/
s->rep->analysers &= ~AN_REQ_WAIT_HTTP;
- s->req->flags |= BF_WAKE_ONCE;
+ s->req->flags |= CF_WAKE_ONCE;
}
if (s->rep->prod->state >= SI_ST_EST) {
@@ -1743,7 +1743,7 @@
rp_prod_last = s->si[1].state;
rpf_last = s->rep->flags;
- if ((s->rep->flags ^ flags) & BF_MASK_STATIC)
+ if ((s->rep->flags ^ flags) & CF_MASK_STATIC)
goto resync_response;
}
@@ -1751,7 +1751,7 @@
if (s->req->analysers & ~req_ana_back)
goto resync_request;
- if ((s->req->flags & ~rqf_last) & BF_MASK_ANALYSER)
+ if ((s->req->flags & ~rqf_last) & CF_MASK_ANALYSER)
goto resync_request;
/* FIXME: here we should call protocol handlers which rely on
@@ -1766,24 +1766,24 @@
*/
srv = target_srv(&s->target);
if (unlikely(!(s->flags & SN_ERR_MASK))) {
- if (s->req->flags & (BF_READ_ERROR|BF_READ_TIMEOUT|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) {
+ if (s->req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) {
/* Report it if the client got an error or a read timeout expired */
s->req->analysers = 0;
- if (s->req->flags & BF_READ_ERROR) {
+ if (s->req->flags & CF_READ_ERROR) {
s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLICL;
}
- else if (s->req->flags & BF_READ_TIMEOUT) {
+ else if (s->req->flags & CF_READ_TIMEOUT) {
s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLITO;
}
- else if (s->req->flags & BF_WRITE_ERROR) {
+ else if (s->req->flags & CF_WRITE_ERROR) {
s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv)
@@ -1799,24 +1799,24 @@
}
sess_set_term_flags(s);
}
- else if (s->rep->flags & (BF_READ_ERROR|BF_READ_TIMEOUT|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) {
+ else if (s->rep->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) {
/* Report it if the server got an error or a read timeout expired */
s->rep->analysers = 0;
- if (s->rep->flags & BF_READ_ERROR) {
+ if (s->rep->flags & CF_READ_ERROR) {
s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVCL;
}
- else if (s->rep->flags & BF_READ_TIMEOUT) {
+ else if (s->rep->flags & CF_READ_TIMEOUT) {
s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVTO;
}
- else if (s->rep->flags & BF_WRITE_ERROR) {
+ else if (s->rep->flags & CF_WRITE_ERROR) {
s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv)
@@ -1842,13 +1842,13 @@
/* If noone is interested in analysing data, it's time to forward
* everything. We configure the buffer to forward indefinitely.
- * Note that we're checking BF_SHUTR_NOW as an indication of a possible
+ * Note that we're checking CF_SHUTR_NOW as an indication of a possible
* recent call to buffer_abort().
*/
if (!s->req->analysers &&
- !(s->req->flags & (BF_HIJACK|BF_SHUTW|BF_SHUTR_NOW)) &&
+ !(s->req->flags & (CF_HIJACK|CF_SHUTW|CF_SHUTR_NOW)) &&
(s->req->prod->state >= SI_ST_EST) &&
- (s->req->to_forward != BUF_INFINITE_FORWARD)) {
+ (s->req->to_forward != CHN_INFINITE_FORWARD)) {
/* This buffer is freewheeling, there's no analyser nor hijacker
* attached to it. If any data are left in, we'll permit them to
* move.
@@ -1861,20 +1861,20 @@
/* We'll let data flow between the producer (if still connected)
* to the consumer (which might possibly not be connected yet).
*/
- if (!(s->req->flags & (BF_SHUTR|BF_SHUTW_NOW)))
- buffer_forward(s->req, BUF_INFINITE_FORWARD);
+ if (!(s->req->flags & (CF_SHUTR|CF_SHUTW_NOW)))
+ buffer_forward(s->req, CHN_INFINITE_FORWARD);
}
/* check if it is wise to enable kernel splicing to forward request data */
- if (!(s->req->flags & (BF_KERN_SPLICING|BF_SHUTR)) &&
+ if (!(s->req->flags & (CF_KERN_SPLICING|CF_SHUTR)) &&
s->req->to_forward &&
(global.tune.options & GTUNE_USE_SPLICE) &&
(s->si[0].flags & s->si[1].flags & SI_FL_CAP_SPLICE) &&
(pipes_used < global.maxpipes) &&
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) ||
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
- (s->req->flags & BF_STREAMER_FAST)))) {
- s->req->flags |= BF_KERN_SPLICING;
+ (s->req->flags & CF_STREAMER_FAST)))) {
+ s->req->flags |= CF_KERN_SPLICING;
}
/* reflect what the L7 analysers have seen last */
@@ -1888,22 +1888,22 @@
* happen either because the input is closed or because we want to force a close
* once the server has begun to respond.
*/
- if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK|BF_AUTO_CLOSE|BF_SHUTR)) ==
- (BF_AUTO_CLOSE|BF_SHUTR)))
+ if (unlikely((s->req->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_HIJACK|CF_AUTO_CLOSE|CF_SHUTR)) ==
+ (CF_AUTO_CLOSE|CF_SHUTR)))
buffer_shutw_now(s->req);
/* shutdown(write) pending */
- if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTW_NOW)) == BF_SHUTW_NOW &&
+ if (unlikely((s->req->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW &&
channel_is_empty(s->req)))
si_shutw(s->req->cons);
/* shutdown(write) done on server side, we must stop the client too */
- if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTW &&
+ if (unlikely((s->req->flags & (CF_SHUTW|CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTW &&
!s->req->analysers))
buffer_shutr_now(s->req);
/* shutdown(read) pending */
- if (unlikely((s->req->flags & (BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTR_NOW)) {
+ if (unlikely((s->req->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) {
if (s->req->prod->flags & SI_FL_NOHALF)
s->req->prod->flags |= SI_FL_NOLINGER;
si_shutr(s->req->prod);
@@ -1912,11 +1912,11 @@
/* it's possible that an upper layer has requested a connection setup or abort.
* There are 2 situations where we decide to establish a new connection :
* - there are data scheduled for emission in the buffer
- * - the BF_AUTO_CONNECT flag is set (active connection)
+ * - the CF_AUTO_CONNECT flag is set (active connection)
*/
if (s->req->cons->state == SI_ST_INI) {
- if (!(s->req->flags & BF_SHUTW)) {
- if ((s->req->flags & BF_AUTO_CONNECT) || !channel_is_empty(s->req)) {
+ if (!(s->req->flags & CF_SHUTW)) {
+ if ((s->req->flags & CF_AUTO_CONNECT) || !channel_is_empty(s->req)) {
/* If we have an applet without a connect method, we immediately
* switch to the connected state, otherwise we perform a connection
* request.
@@ -1926,7 +1926,7 @@
if (unlikely(s->req->cons->target.type == TARG_TYPE_APPLET &&
!(si_ctrl(s->req->cons) && si_ctrl(s->req->cons)->connect))) {
s->req->cons->state = SI_ST_EST; /* connection established */
- s->rep->flags |= BF_READ_ATTACHED; /* producer is now attached */
+ s->rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
s->req->wex = TICK_ETERNITY;
}
}
@@ -1971,20 +1971,20 @@
goto resync_stream_interface;
/* otherwise we want to check if we need to resync the req buffer or not */
- if ((s->req->flags ^ rqf_last) & BF_MASK_STATIC)
+ if ((s->req->flags ^ rqf_last) & CF_MASK_STATIC)
goto resync_request;
/* perform output updates to the response buffer */
/* If noone is interested in analysing data, it's time to forward
* everything. We configure the buffer to forward indefinitely.
- * Note that we're checking BF_SHUTR_NOW as an indication of a possible
+ * Note that we're checking CF_SHUTR_NOW as an indication of a possible
* recent call to buffer_abort().
*/
if (!s->rep->analysers &&
- !(s->rep->flags & (BF_HIJACK|BF_SHUTW|BF_SHUTR_NOW)) &&
+ !(s->rep->flags & (CF_HIJACK|CF_SHUTW|CF_SHUTR_NOW)) &&
(s->rep->prod->state >= SI_ST_EST) &&
- (s->rep->to_forward != BUF_INFINITE_FORWARD)) {
+ (s->rep->to_forward != CHN_INFINITE_FORWARD)) {
/* This buffer is freewheeling, there's no analyser nor hijacker
* attached to it. If any data are left in, we'll permit them to
* move.
@@ -1996,8 +1996,8 @@
/* We'll let data flow between the producer (if still connected)
* to the consumer.
*/
- if (!(s->rep->flags & (BF_SHUTR|BF_SHUTW_NOW)))
- buffer_forward(s->rep, BUF_INFINITE_FORWARD);
+ if (!(s->rep->flags & (CF_SHUTR|CF_SHUTW_NOW)))
+ buffer_forward(s->rep, CHN_INFINITE_FORWARD);
/* if we have no analyser anymore in any direction and have a
* tunnel timeout set, use it now.
@@ -2011,15 +2011,15 @@
}
/* check if it is wise to enable kernel splicing to forward response data */
- if (!(s->rep->flags & (BF_KERN_SPLICING|BF_SHUTR)) &&
+ if (!(s->rep->flags & (CF_KERN_SPLICING|CF_SHUTR)) &&
s->rep->to_forward &&
(global.tune.options & GTUNE_USE_SPLICE) &&
(s->si[0].flags & s->si[1].flags & SI_FL_CAP_SPLICE) &&
(pipes_used < global.maxpipes) &&
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) ||
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
- (s->rep->flags & BF_STREAMER_FAST)))) {
- s->rep->flags |= BF_KERN_SPLICING;
+ (s->rep->flags & CF_STREAMER_FAST)))) {
+ s->rep->flags |= CF_KERN_SPLICING;
}
/* reflect what the L7 analysers have seen last */
@@ -2034,22 +2034,22 @@
*/
/* first, let's check if the response buffer needs to shutdown(write) */
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK|BF_AUTO_CLOSE|BF_SHUTR)) ==
- (BF_AUTO_CLOSE|BF_SHUTR)))
+ if (unlikely((s->rep->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_HIJACK|CF_AUTO_CLOSE|CF_SHUTR)) ==
+ (CF_AUTO_CLOSE|CF_SHUTR)))
buffer_shutw_now(s->rep);
/* shutdown(write) pending */
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_SHUTW_NOW)) == BF_SHUTW_NOW &&
+ if (unlikely((s->rep->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW &&
channel_is_empty(s->rep)))
si_shutw(s->rep->cons);
/* shutdown(write) done on the client side, we must stop the server too */
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTW) &&
+ if (unlikely((s->rep->flags & (CF_SHUTW|CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTW) &&
!s->rep->analysers)
buffer_shutr_now(s->rep);
/* shutdown(read) pending */
- if (unlikely((s->rep->flags & (BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTR_NOW)) {
+ if (unlikely((s->rep->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) {
if (s->rep->prod->flags & SI_FL_NOHALF)
s->rep->prod->flags |= SI_FL_NOLINGER;
si_shutr(s->rep->prod);
@@ -2061,7 +2061,7 @@
if (s->req->flags != rqf_last)
goto resync_request;
- if ((s->rep->flags ^ rpf_last) & BF_MASK_STATIC)
+ if ((s->rep->flags ^ rpf_last) & CF_MASK_STATIC)
goto resync_response;
/* we're interested in getting wakeups again */
@@ -2109,8 +2109,8 @@
if (s->req->cons->state == SI_ST_EST && s->req->cons->target.type != TARG_TYPE_APPLET)
si_update(s->req->cons);
- s->req->flags &= ~(BF_READ_NULL|BF_READ_PARTIAL|BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_READ_ATTACHED);
- s->rep->flags &= ~(BF_READ_NULL|BF_READ_PARTIAL|BF_WRITE_NULL|BF_WRITE_PARTIAL|BF_READ_ATTACHED);
+ s->req->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_WRITE_NULL|CF_WRITE_PARTIAL|CF_READ_ATTACHED);
+ s->rep->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_WRITE_NULL|CF_WRITE_PARTIAL|CF_READ_ATTACHED);
s->si[0].prev_state = s->si[0].state;
s->si[1].prev_state = s->si[1].state;
s->si[0].flags &= ~(SI_FL_ERR|SI_FL_EXP);
@@ -2124,9 +2124,9 @@
* request timeout is set and the server has not yet sent a response.
*/
- if ((s->rep->flags & (BF_AUTO_CLOSE|BF_SHUTR)) == 0 &&
+ if ((s->rep->flags & (CF_AUTO_CLOSE|CF_SHUTR)) == 0 &&
(tick_isset(s->req->wex) || tick_isset(s->rep->rex))) {
- s->req->flags |= BF_READ_NOEXP;
+ s->req->flags |= CF_READ_NOEXP;
s->req->rex = TICK_ETERNITY;
}
@@ -2310,7 +2310,7 @@
/* kill a session and set the termination flags to <why> (one of SN_ERR_*) */
void session_shutdown(struct session *session, int why)
{
- if (session->req->flags & (BF_SHUTW|BF_SHUTW_NOW))
+ if (session->req->flags & (CF_SHUTW|CF_SHUTW_NOW))
return;
buffer_shutw_now(session->req);
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 4f31343..ae633ea 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -93,8 +93,8 @@
if (!si->err_type)
si->err_type = SI_ET_DATA_ERR;
- si->ob->flags |= BF_WRITE_ERROR;
- si->ib->flags |= BF_READ_ERROR;
+ si->ob->flags |= CF_WRITE_ERROR;
+ si->ib->flags |= CF_READ_ERROR;
}
/*
@@ -146,38 +146,38 @@
if (si->state != SI_ST_EST)
return;
- if ((si->ob->flags & (BF_SHUTW|BF_HIJACK|BF_SHUTW_NOW)) == BF_SHUTW_NOW &&
+ if ((si->ob->flags & (CF_SHUTW|CF_HIJACK|CF_SHUTW_NOW)) == CF_SHUTW_NOW &&
channel_is_empty(si->ob))
si_shutw(si);
- if ((si->ob->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK)) == 0 && !channel_full(si->ob))
+ if ((si->ob->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_HIJACK)) == 0 && !channel_full(si->ob))
si->flags |= SI_FL_WAIT_DATA;
/* we're almost sure that we need some space if the buffer is not
* empty, even if it's not full, because the applets can't fill it.
*/
- if ((si->ib->flags & (BF_SHUTR|BF_DONT_READ)) == 0 && !channel_is_empty(si->ib))
+ if ((si->ib->flags & (CF_SHUTR|CF_DONT_READ)) == 0 && !channel_is_empty(si->ib))
si->flags |= SI_FL_WAIT_ROOM;
- if (si->ob->flags & BF_WRITE_ACTIVITY) {
+ if (si->ob->flags & CF_WRITE_ACTIVITY) {
if (tick_isset(si->ob->wex))
si->ob->wex = tick_add_ifset(now_ms, si->ob->wto);
}
- if (si->ib->flags & BF_READ_ACTIVITY ||
- (si->ob->flags & BF_WRITE_ACTIVITY && !(si->flags & SI_FL_INDEP_STR))) {
+ if (si->ib->flags & CF_READ_ACTIVITY ||
+ (si->ob->flags & CF_WRITE_ACTIVITY && !(si->flags & SI_FL_INDEP_STR))) {
if (tick_isset(si->ib->rex))
si->ib->rex = tick_add_ifset(now_ms, si->ib->rto);
}
/* save flags to detect changes */
old_flags = si->flags;
- if (likely((si->ob->flags & (BF_SHUTW|BF_WRITE_PARTIAL|BF_DONT_READ)) == BF_WRITE_PARTIAL &&
+ if (likely((si->ob->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL &&
!channel_full(si->ob) &&
(si->ob->prod->flags & SI_FL_WAIT_ROOM)))
si_chk_rcv(si->ob->prod);
- if (((si->ib->flags & BF_READ_PARTIAL) && !channel_is_empty(si->ib)) &&
+ if (((si->ib->flags & CF_READ_PARTIAL) && !channel_is_empty(si->ib)) &&
(si->ib->cons->flags & SI_FL_WAIT_DATA)) {
si_chk_snd(si->ib->cons);
/* check if the consumer has freed some space */
@@ -196,23 +196,23 @@
((old_flags & ~si->flags) & (SI_FL_WAIT_ROOM|SI_FL_WAIT_DATA)) ||
/* changes on the production side */
- (si->ib->flags & (BF_READ_NULL|BF_READ_ERROR)) ||
+ (si->ib->flags & (CF_READ_NULL|CF_READ_ERROR)) ||
si->state != SI_ST_EST ||
(si->flags & SI_FL_ERR) ||
- ((si->ib->flags & BF_READ_PARTIAL) &&
+ ((si->ib->flags & CF_READ_PARTIAL) &&
(!si->ib->to_forward || si->ib->cons->state != SI_ST_EST)) ||
/* changes on the consumption side */
- (si->ob->flags & (BF_WRITE_NULL|BF_WRITE_ERROR)) ||
- ((si->ob->flags & BF_WRITE_ACTIVITY) &&
- ((si->ob->flags & BF_SHUTW) ||
+ (si->ob->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) ||
+ ((si->ob->flags & CF_WRITE_ACTIVITY) &&
+ ((si->ob->flags & CF_SHUTW) ||
si->ob->prod->state != SI_ST_EST ||
(channel_is_empty(si->ob) && !si->ob->to_forward)))) {
if (!(si->flags & SI_FL_DONT_WAKE) && si->owner)
task_wakeup(si->owner, TASK_WOKEN_IO);
}
- if (si->ib->flags & BF_READ_ACTIVITY)
- si->ib->flags &= ~BF_READ_DONTWAIT;
+ if (si->ib->flags & CF_READ_ACTIVITY)
+ si->ib->flags &= ~CF_READ_DONTWAIT;
}
/*
@@ -232,17 +232,17 @@
{
struct connection *conn = &si->conn;
- si->ib->flags &= ~BF_SHUTR_NOW;
- if (si->ib->flags & BF_SHUTR)
+ si->ib->flags &= ~CF_SHUTR_NOW;
+ if (si->ib->flags & CF_SHUTR)
return 0;
- si->ib->flags |= BF_SHUTR;
+ si->ib->flags |= CF_SHUTR;
si->ib->rex = TICK_ETERNITY;
si->flags &= ~SI_FL_WAIT_ROOM;
if (si->state != SI_ST_EST && si->state != SI_ST_CON)
return 0;
- if (si->ob->flags & BF_SHUTW) {
+ if (si->ob->flags & CF_SHUTW) {
conn_data_close(&si->conn);
if (conn->ctrl)
fd_delete(si_fd(si));
@@ -283,10 +283,10 @@
{
struct connection *conn = &si->conn;
- si->ob->flags &= ~BF_SHUTW_NOW;
- if (si->ob->flags & BF_SHUTW)
+ si->ob->flags &= ~CF_SHUTW_NOW;
+ if (si->ob->flags & CF_SHUTW)
return 0;
- si->ob->flags |= BF_SHUTW;
+ si->ob->flags |= CF_SHUTW;
si->ob->wex = TICK_ETERNITY;
si->flags &= ~SI_FL_WAIT_DATA;
@@ -320,7 +320,7 @@
if (conn->ctrl)
shutdown(si_fd(si), SHUT_WR);
- if (!(si->ib->flags & (BF_SHUTR|BF_DONT_READ))) {
+ if (!(si->ib->flags & (CF_SHUTR|CF_DONT_READ))) {
/* OK just a shutw, but we want the caller
* to disable polling on this FD if exists.
*/
@@ -347,7 +347,7 @@
si->release(si);
default:
si->flags &= ~SI_FL_WAIT_ROOM;
- si->ib->flags |= BF_SHUTR;
+ si->ib->flags |= CF_SHUTR;
si->ib->rex = TICK_ETERNITY;
si->exp = TICK_ETERNITY;
}
@@ -367,7 +367,7 @@
__FUNCTION__,
si, si->state, si->ib->flags, si->ob->flags);
- if (unlikely(si->state != SI_ST_EST || (ib->flags & (BF_SHUTR|BF_HIJACK|BF_DONT_READ))))
+ if (unlikely(si->state != SI_ST_EST || (ib->flags & (CF_SHUTR|CF_HIJACK|CF_DONT_READ))))
return;
if (channel_full(ib)) {
@@ -391,7 +391,7 @@
__FUNCTION__,
si, si->state, si->ib->flags, si->ob->flags);
- if (unlikely(si->state != SI_ST_EST || (si->ob->flags & BF_SHUTW)))
+ if (unlikely(si->state != SI_ST_EST || (si->ob->flags & CF_SHUTW)))
return;
if (!(si->flags & SI_FL_WAIT_DATA) || /* not waiting for data */
@@ -574,24 +574,24 @@
/* check for recent connection establishment */
if (unlikely(!(conn->flags & (CO_FL_WAIT_L4_CONN | CO_FL_WAIT_L6_CONN | CO_FL_CONNECTED)))) {
si->exp = TICK_ETERNITY;
- si->ob->flags |= BF_WRITE_NULL;
+ si->ob->flags |= CF_WRITE_NULL;
}
/* process consumer side */
if (channel_is_empty(si->ob)) {
- if (((si->ob->flags & (BF_SHUTW|BF_HIJACK|BF_SHUTW_NOW)) == BF_SHUTW_NOW) &&
+ if (((si->ob->flags & (CF_SHUTW|CF_HIJACK|CF_SHUTW_NOW)) == CF_SHUTW_NOW) &&
(si->state == SI_ST_EST))
stream_int_shutw(si);
__conn_data_stop_send(conn);
si->ob->wex = TICK_ETERNITY;
}
- if ((si->ob->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK)) == 0 && !channel_full(si->ob))
+ if ((si->ob->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_HIJACK)) == 0 && !channel_full(si->ob))
si->flags |= SI_FL_WAIT_DATA;
- if (si->ob->flags & BF_WRITE_ACTIVITY) {
+ if (si->ob->flags & CF_WRITE_ACTIVITY) {
/* update timeouts if we have written something */
- if ((si->ob->flags & (BF_SHUTW|BF_WRITE_PARTIAL)) == BF_WRITE_PARTIAL &&
+ if ((si->ob->flags & (CF_SHUTW|CF_WRITE_PARTIAL)) == CF_WRITE_PARTIAL &&
!channel_is_empty(si->ob))
if (tick_isset(si->ob->wex))
si->ob->wex = tick_add_ifset(now_ms, si->ob->wto);
@@ -600,7 +600,7 @@
if (tick_isset(si->ib->rex))
si->ib->rex = tick_add_ifset(now_ms, si->ib->rto);
- if (likely((si->ob->flags & (BF_SHUTW|BF_WRITE_PARTIAL|BF_DONT_READ)) == BF_WRITE_PARTIAL &&
+ if (likely((si->ob->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL &&
!channel_full(si->ob) &&
(si->ob->prod->flags & SI_FL_WAIT_ROOM)))
si_chk_rcv(si->ob->prod);
@@ -613,7 +613,7 @@
* immediately afterwards once the following data is parsed (eg:
* HTTP chunking).
*/
- if (((si->ib->flags & BF_READ_PARTIAL) && !channel_is_empty(si->ib)) &&
+ if (((si->ib->flags & CF_READ_PARTIAL) && !channel_is_empty(si->ib)) &&
(si->ib->pipe /* always try to send spliced data */ ||
(si->ib->buf.i == 0 && (si->ib->cons->flags & SI_FL_WAIT_DATA)))) {
int last_len = si->ib->pipe ? si->ib->pipe->data : 0;
@@ -632,7 +632,7 @@
__conn_data_stop_recv(conn);
si->ib->rex = TICK_ETERNITY;
}
- else if ((si->ib->flags & (BF_SHUTR|BF_READ_PARTIAL|BF_DONT_READ|BF_READ_NOEXP)) == BF_READ_PARTIAL &&
+ else if ((si->ib->flags & (CF_SHUTR|CF_READ_PARTIAL|CF_DONT_READ|CF_READ_NOEXP)) == CF_READ_PARTIAL &&
!channel_full(si->ib)) {
if (tick_isset(si->ib->rex))
si->ib->rex = tick_add_ifset(now_ms, si->ib->rto);
@@ -640,22 +640,22 @@
/* wake the task up only when needed */
if (/* changes on the production side */
- (si->ib->flags & (BF_READ_NULL|BF_READ_ERROR)) ||
+ (si->ib->flags & (CF_READ_NULL|CF_READ_ERROR)) ||
si->state != SI_ST_EST ||
(si->flags & SI_FL_ERR) ||
- ((si->ib->flags & BF_READ_PARTIAL) &&
+ ((si->ib->flags & CF_READ_PARTIAL) &&
(!si->ib->to_forward || si->ib->cons->state != SI_ST_EST)) ||
/* changes on the consumption side */
- (si->ob->flags & (BF_WRITE_NULL|BF_WRITE_ERROR)) ||
- ((si->ob->flags & BF_WRITE_ACTIVITY) &&
- ((si->ob->flags & BF_SHUTW) ||
+ (si->ob->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) ||
+ ((si->ob->flags & CF_WRITE_ACTIVITY) &&
+ ((si->ob->flags & CF_SHUTW) ||
si->ob->prod->state != SI_ST_EST ||
(channel_is_empty(si->ob) && !si->ob->to_forward)))) {
task_wakeup(si->owner, TASK_WOKEN_IO);
}
- if (si->ib->flags & BF_READ_ACTIVITY)
- si->ib->flags &= ~BF_READ_DONTWAIT;
+ if (si->ib->flags & CF_READ_ACTIVITY)
+ si->ib->flags &= ~CF_READ_DONTWAIT;
}
/*
@@ -676,7 +676,7 @@
if (b->pipe && conn->data->snd_pipe) {
ret = conn->data->snd_pipe(conn, b->pipe);
if (ret > 0)
- b->flags |= BF_WRITE_PARTIAL;
+ b->flags |= CF_WRITE_PARTIAL;
if (!b->pipe->data) {
put_pipe(b->pipe);
@@ -714,10 +714,10 @@
*/
unsigned int send_flag = MSG_DONTWAIT | MSG_NOSIGNAL;
- if ((!(b->flags & (BF_NEVER_WAIT|BF_SEND_DONTWAIT)) &&
- ((b->to_forward && b->to_forward != BUF_INFINITE_FORWARD) ||
- (b->flags & BF_EXPECT_MORE))) ||
- ((b->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK)) == BF_SHUTW_NOW))
+ if ((!(b->flags & (CF_NEVER_WAIT|CF_SEND_DONTWAIT)) &&
+ ((b->to_forward && b->to_forward != CHN_INFINITE_FORWARD) ||
+ (b->flags & CF_EXPECT_MORE))) ||
+ ((b->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_HIJACK)) == CF_SHUTW_NOW))
send_flag |= MSG_MORE;
ret = conn->data->snd_buf(conn, &b->buf, send_flag);
@@ -727,11 +727,11 @@
if (si->conn.flags & CO_FL_WAIT_L4_CONN)
si->conn.flags &= ~CO_FL_WAIT_L4_CONN;
- b->flags |= BF_WRITE_PARTIAL;
+ b->flags |= CF_WRITE_PARTIAL;
if (!b->buf.o) {
/* Always clear both flags once everything has been sent, they're one-shot */
- b->flags &= ~(BF_EXPECT_MORE | BF_SEND_DONTWAIT);
+ b->flags &= ~(CF_EXPECT_MORE | CF_SEND_DONTWAIT);
break;
}
@@ -769,12 +769,12 @@
}
/* Check if we need to close the read side */
- if (!(ib->flags & BF_SHUTR)) {
+ if (!(ib->flags & CF_SHUTR)) {
/* Read not closed, update FD status and timeout for reads */
- if ((ib->flags & (BF_HIJACK|BF_DONT_READ)) || channel_full(ib)) {
+ if ((ib->flags & (CF_HIJACK|CF_DONT_READ)) || channel_full(ib)) {
/* stop reading */
if (!(si->flags & SI_FL_WAIT_ROOM)) {
- if (!(ib->flags & (BF_HIJACK|BF_DONT_READ))) /* full */
+ if (!(ib->flags & (CF_HIJACK|CF_DONT_READ))) /* full */
si->flags |= SI_FL_WAIT_ROOM;
conn_data_stop_recv(&si->conn);
ib->rex = TICK_ETERNITY;
@@ -788,18 +788,18 @@
*/
si->flags &= ~SI_FL_WAIT_ROOM;
conn_data_want_recv(&si->conn);
- if (!(ib->flags & (BF_READ_NOEXP|BF_DONT_READ)) && !tick_isset(ib->rex))
+ if (!(ib->flags & (CF_READ_NOEXP|CF_DONT_READ)) && !tick_isset(ib->rex))
ib->rex = tick_add_ifset(now_ms, ib->rto);
}
}
/* Check if we need to close the write side */
- if (!(ob->flags & BF_SHUTW)) {
+ if (!(ob->flags & CF_SHUTW)) {
/* Write not closed, update FD status and timeout for writes */
if (channel_is_empty(ob)) {
/* stop writing */
if (!(si->flags & SI_FL_WAIT_DATA)) {
- if ((ob->flags & (BF_HIJACK|BF_SHUTW_NOW)) == 0)
+ if ((ob->flags & (CF_HIJACK|CF_SHUTW_NOW)) == 0)
si->flags |= SI_FL_WAIT_DATA;
conn_data_stop_send(&si->conn);
ob->wex = TICK_ETERNITY;
@@ -839,7 +839,7 @@
{
struct channel *ib = si->ib;
- if (unlikely(si->state != SI_ST_EST || (ib->flags & BF_SHUTR)))
+ if (unlikely(si->state != SI_ST_EST || (ib->flags & CF_SHUTR)))
return;
if (si->conn.flags & CO_FL_HANDSHAKE) {
@@ -847,9 +847,9 @@
return;
}
- if ((ib->flags & (BF_HIJACK|BF_DONT_READ)) || channel_full(ib)) {
+ if ((ib->flags & (CF_HIJACK|CF_DONT_READ)) || channel_full(ib)) {
/* stop reading */
- if (!(ib->flags & (BF_HIJACK|BF_DONT_READ))) /* full */
+ if (!(ib->flags & (CF_HIJACK|CF_DONT_READ))) /* full */
si->flags |= SI_FL_WAIT_ROOM;
conn_data_stop_recv(&si->conn);
}
@@ -870,7 +870,7 @@
{
struct channel *ob = si->ob;
- if (unlikely(si->state != SI_ST_EST || (ob->flags & BF_SHUTW)))
+ if (unlikely(si->state != SI_ST_EST || (ob->flags & CF_SHUTW)))
return;
/* handshake running on producer */
@@ -907,14 +907,14 @@
* ->o limit was reached. Maybe we just wrote the last
* chunk and need to close.
*/
- if (((ob->flags & (BF_SHUTW|BF_HIJACK|BF_AUTO_CLOSE|BF_SHUTW_NOW)) ==
- (BF_AUTO_CLOSE|BF_SHUTW_NOW)) &&
+ if (((ob->flags & (CF_SHUTW|CF_HIJACK|CF_AUTO_CLOSE|CF_SHUTW_NOW)) ==
+ (CF_AUTO_CLOSE|CF_SHUTW_NOW)) &&
(si->state == SI_ST_EST)) {
si_shutw(si);
goto out_wakeup;
}
- if ((ob->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK)) == 0)
+ if ((ob->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_HIJACK)) == 0)
si->flags |= SI_FL_WAIT_DATA;
ob->wex = TICK_ETERNITY;
}
@@ -928,9 +928,9 @@
ob->wex = tick_add_ifset(now_ms, ob->wto);
}
- if (likely(ob->flags & BF_WRITE_ACTIVITY)) {
+ if (likely(ob->flags & CF_WRITE_ACTIVITY)) {
/* update timeout if we have written something */
- if ((ob->flags & (BF_SHUTW|BF_WRITE_PARTIAL)) == BF_WRITE_PARTIAL &&
+ if ((ob->flags & (CF_SHUTW|CF_WRITE_PARTIAL)) == CF_WRITE_PARTIAL &&
!channel_is_empty(ob))
ob->wex = tick_add_ifset(now_ms, ob->wto);
@@ -950,7 +950,7 @@
/* in case of special condition (error, shutdown, end of write...), we
* have to notify the task.
*/
- if (likely((ob->flags & (BF_WRITE_NULL|BF_WRITE_ERROR|BF_SHUTW)) ||
+ if (likely((ob->flags & (CF_WRITE_NULL|CF_WRITE_ERROR|CF_SHUTW)) ||
(channel_is_empty(ob) && !ob->to_forward) ||
si->state != SI_ST_EST)) {
out_wakeup:
@@ -988,7 +988,7 @@
goto out_shutdown_r;
/* maybe we were called immediately after an asynchronous shutr */
- if (b->flags & BF_SHUTR)
+ if (b->flags & CF_SHUTR)
return;
cur_read = 0;
@@ -998,7 +998,7 @@
* using a buffer.
*/
if (conn->data->rcv_pipe &&
- b->to_forward >= MIN_SPLICE_FORWARD && b->flags & BF_KERN_SPLICING) {
+ b->to_forward >= MIN_SPLICE_FORWARD && b->flags & CF_KERN_SPLICING) {
if (buffer_not_empty(&b->buf)) {
/* We're embarrassed, there are already data pending in
* the buffer and we don't want to have them at two
@@ -1010,7 +1010,7 @@
if (unlikely(b->pipe == NULL)) {
if (pipes_used >= global.maxpipes || !(b->pipe = get_pipe())) {
- b->flags &= ~BF_KERN_SPLICING;
+ b->flags &= ~CF_KERN_SPLICING;
goto abort_splice;
}
}
@@ -1018,17 +1018,17 @@
ret = conn->data->rcv_pipe(conn, b->pipe, b->to_forward);
if (ret < 0) {
/* splice not supported on this end, let's disable it */
- b->flags &= ~BF_KERN_SPLICING;
+ b->flags &= ~CF_KERN_SPLICING;
si->flags &= ~SI_FL_CAP_SPLICE;
goto abort_splice;
}
if (ret > 0) {
- if (b->to_forward != BUF_INFINITE_FORWARD)
+ if (b->to_forward != CHN_INFINITE_FORWARD)
b->to_forward -= ret;
b->total += ret;
cur_read += ret;
- b->flags |= BF_READ_PARTIAL;
+ b->flags |= CF_READ_PARTIAL;
}
if (conn_data_read0_pending(conn))
@@ -1062,9 +1062,9 @@
cur_read += ret;
/* if we're allowed to directly forward data, we must update ->o */
- if (b->to_forward && !(b->flags & (BF_SHUTW|BF_SHUTW_NOW))) {
+ if (b->to_forward && !(b->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
unsigned long fwd = ret;
- if (b->to_forward != BUF_INFINITE_FORWARD) {
+ if (b->to_forward != CHN_INFINITE_FORWARD) {
if (fwd > b->to_forward)
fwd = b->to_forward;
b->to_forward -= fwd;
@@ -1075,25 +1075,25 @@
if (conn->flags & CO_FL_WAIT_L4_CONN)
conn->flags &= ~CO_FL_WAIT_L4_CONN;
- b->flags |= BF_READ_PARTIAL;
+ b->flags |= CF_READ_PARTIAL;
b->total += ret;
if (channel_full(b)) {
/* The buffer is now full, there's no point in going through
* the loop again.
*/
- if (!(b->flags & BF_STREAMER_FAST) && (cur_read == buffer_len(&b->buf))) {
+ if (!(b->flags & CF_STREAMER_FAST) && (cur_read == buffer_len(&b->buf))) {
b->xfer_small = 0;
b->xfer_large++;
if (b->xfer_large >= 3) {
/* we call this buffer a fast streamer if it manages
* to be filled in one call 3 consecutive times.
*/
- b->flags |= (BF_STREAMER | BF_STREAMER_FAST);
+ b->flags |= (CF_STREAMER | CF_STREAMER_FAST);
//fputc('+', stderr);
}
}
- else if ((b->flags & (BF_STREAMER | BF_STREAMER_FAST)) &&
+ else if ((b->flags & (CF_STREAMER | CF_STREAMER_FAST)) &&
(cur_read <= b->buf.size / 2)) {
b->xfer_large = 0;
b->xfer_small++;
@@ -1102,7 +1102,7 @@
* we receive faster than we send, so at least it
* is not a "fast streamer".
*/
- b->flags &= ~BF_STREAMER_FAST;
+ b->flags &= ~CF_STREAMER_FAST;
//fputc('-', stderr);
}
}
@@ -1115,7 +1115,7 @@
break;
}
- if ((b->flags & BF_READ_DONTWAIT) || --read_poll <= 0)
+ if ((b->flags & CF_READ_DONTWAIT) || --read_poll <= 0)
break;
/* if too many bytes were missing from last read, it means that
@@ -1123,7 +1123,7 @@
* not have them in buffers.
*/
if (ret < max) {
- if ((b->flags & (BF_STREAMER | BF_STREAMER_FAST)) &&
+ if ((b->flags & (CF_STREAMER | CF_STREAMER_FAST)) &&
(cur_read <= b->buf.size / 2)) {
b->xfer_large = 0;
b->xfer_small++;
@@ -1132,7 +1132,7 @@
* one pass, and this happened at least 3 times.
* This is definitely not a streamer.
*/
- b->flags &= ~(BF_STREAMER | BF_STREAMER_FAST);
+ b->flags &= ~(CF_STREAMER | CF_STREAMER_FAST);
//fputc('!', stderr);
}
}
@@ -1141,7 +1141,7 @@
* have exhausted system buffers. It's not worth trying
* again.
*/
- if (b->flags & BF_STREAMER)
+ if (b->flags & CF_STREAMER)
break;
/* if we read a large block smaller than what we requested,
@@ -1177,8 +1177,8 @@
out_shutdown_r:
/* we received a shutdown */
- b->flags |= BF_READ_NULL;
- if (b->flags & BF_AUTO_CLOSE)
+ b->flags |= CF_READ_NULL;
+ if (b->flags & CF_AUTO_CLOSE)
buffer_shutw_now(b);
stream_sock_read0(si);
conn_data_read0(conn);
@@ -1208,7 +1208,7 @@
return;
/* we might have been called just after an asynchronous shutw */
- if (b->flags & BF_SHUTW)
+ if (b->flags & CF_SHUTW)
return;
/* OK there are data waiting to be sent */
@@ -1233,17 +1233,17 @@
*/
void stream_sock_read0(struct stream_interface *si)
{
- si->ib->flags &= ~BF_SHUTR_NOW;
- if (si->ib->flags & BF_SHUTR)
+ si->ib->flags &= ~CF_SHUTR_NOW;
+ if (si->ib->flags & CF_SHUTR)
return;
- si->ib->flags |= BF_SHUTR;
+ si->ib->flags |= CF_SHUTR;
si->ib->rex = TICK_ETERNITY;
si->flags &= ~SI_FL_WAIT_ROOM;
if (si->state != SI_ST_EST && si->state != SI_ST_CON)
return;
- if (si->ob->flags & BF_SHUTW)
+ if (si->ob->flags & CF_SHUTW)
goto do_close;
if (si->flags & SI_FL_NOHALF) {