MEDIUM: connection: remove useless flag CO_FL_DATA_WR_SH
After careful inspection, this flag is set at exactly two places :
- once in the health-check receive callback after receipt of a
response
- once in the stream interface's shutw() code where CF_SHUTW is
always set on chn->flags
The flag was checked in the checks before deciding to send data, but
when it is set, the wake() callback immediately closes the connection
so the CO_FL_SOCK_WR_SH flag is also set.
The flag was also checked in si_conn_send(), but checking the channel's
flag instead is enough and even reveals that one check involving it
could never match.
So it's time to remove this flag and replace its check with a check of
CF_SHUTW in the stream interface. This way each layer is responsible
for its shutdown, this will ease insertion of the mux layer.
diff --git a/src/stream_interface.c b/src/stream_interface.c
index c19c146..c3e2c53 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -633,7 +633,7 @@
/* when we're here, we already know that there is no spliced
* data left, and that there are sendable buffered data.
*/
- if (!(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_DATA_WR_SH | CO_FL_HANDSHAKE))) {
+ if (!(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_HANDSHAKE)) && !(oc->flags & CF_SHUTW)) {
/* check if we want to inform the kernel that we're interested in
* sending more data after this call. We want this if :
* - we're about to close after this last send and want to merge
@@ -648,8 +648,7 @@
if ((!(oc->flags & (CF_NEVER_WAIT|CF_SEND_DONTWAIT)) &&
((oc->to_forward && oc->to_forward != CHN_INFINITE_FORWARD) ||
- (oc->flags & CF_EXPECT_MORE))) ||
- ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW))
+ (oc->flags & CF_EXPECT_MORE))) || (oc->flags & CF_SHUTW_NOW))
send_flag |= CO_SFL_MSG_MORE;
if (oc->flags & CF_STREAMER)