[MAJOR] buffers: split BF_WRITE_ENA into BF_AUTO_CONNECT and BF_AUTO_CLOSE
authorWilly Tarreau <w@1wt.eu>
Sat, 19 Sep 2009 19:04:57 +0000 (21:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 19 Sep 2009 19:14:54 +0000 (21:14 +0200)
commit520d95e42b89cbb0a3f97ea72ee7f85121209741
treef06b3555983372316fb5bd2ff39b8d074aa6b33a
parentc77e7619689c8ccd77ce1a80d379579a86f03843
[MAJOR] buffers: split BF_WRITE_ENA into BF_AUTO_CONNECT and BF_AUTO_CLOSE

The BF_WRITE_ENA buffer flag became very complex to deal with, because
it was used to :
  - enable automatic connection
  - enable close forwarding
  - enable data forwarding

The last point was not very true anymore since we introduced ->send_max,
but still the test remained everywhere. This was causing issues such as
impossibility to connect without forwarding data, impossibility to prevent
closing when data was forwarded, etc...

This patch clarifies the situation by getting rid of this multi-purpose
flag and replacing it with :
  - data forwarding based only on ->send_max || ->pipe ;
  - a new BF_AUTO_CONNECT flag to allow automatic connection and only
    that ;
  - ability to perform an automatic connection when ->send_max or ->pipe
    indicate that data is waiting to leave the buffer ;
  - a new BF_AUTO_CLOSE flag to let the producer automatically set the
    BF_SHUTW_NOW flag when it gets a BF_SHUTR.

During this cleanup, it was discovered that some tests were performed
twice, or that the BF_HIJACK flag was still tested, which is not needed
anymore since ->send_max replcaed it. These places have been fixed too.

These cleanups have also revealed a few areas where the other flags
such as BF_EMPTY are not cleanly used. This will be an opportunity for
a second patch.
include/proto/buffers.h
include/types/buffers.h
src/client.c
src/dumpstats.c
src/proto_http.c
src/proto_tcp.c
src/session.c
src/stream_interface.c
src/stream_sock.c