MINOR: connection: add a new CO_FL_WANT_DRAIN flag to force drain on close

Sometimes we'd like to do our best to drain pending data before closing
in order to save the peer from risking to receive an RST on close.

This adds a new connection flag CO_FL_WANT_DRAIN that is used to
trigger a call to conn_ctrl_drain() from conn_ctrl_close(), and the
sock_drain() function ignores fd_recv_ready() if this flag is set,
in order to catch latest data. It's not used for now.

(cherry picked from commit 20b622e04b27e76f7b4be0c09b435e8799143d75)
[Cf: On previous versions, conn_sock_drain() must be used instead of
     conn_ctrl_drain()]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/sock.c b/src/sock.c
index a1e545f..9d272cc 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -835,7 +835,7 @@
 	if (fdtab[fd].state & (FD_POLL_ERR|FD_POLL_HUP))
 		goto shut;
 
-	if (!fd_recv_ready(fd))
+	if (!(conn->flags & CO_FL_WANT_DRAIN) && !fd_recv_ready(fd))
 		return 0;
 
 	/* no drain function defined, use the generic one */