MEDIUM: connections: Wake the upper layer even if sending/receiving is disabled.

In conn_fd_handler(), if the fd is ready to send/recv, wake the upper layer
even if we have CO_FL_ERROR, or if CO_FL_XPRT_RD_ENA/CO_FL_XPRT_WR_ENA isn't
set. The only reason we should reach that point is if we had a shutw/shutr,
and the upper layer may want to know about it, and is supposed to handle it
anyway.
This commit is contained in:
Olivier Houchard 2019-06-05 17:07:45 +02:00 committed by Olivier Houchard
parent 49065544d0
commit c3df4507fa

View File

@ -111,8 +111,7 @@ void conn_fd_handler(int fd)
if (conn->xprt_done_cb && conn->xprt_done_cb(conn) < 0) if (conn->xprt_done_cb && conn->xprt_done_cb(conn) < 0)
return; return;
if (conn->xprt && fd_send_ready(fd) && if (conn->xprt && fd_send_ready(fd)) {
((conn->flags & (CO_FL_XPRT_WR_ENA|CO_FL_ERROR|CO_FL_HANDSHAKE)) == CO_FL_XPRT_WR_ENA)) {
/* force reporting of activity by clearing the previous flags : /* force reporting of activity by clearing the previous flags :
* we'll have at least ERROR or CONNECTED at the end of an I/O, * we'll have at least ERROR or CONNECTED at the end of an I/O,
* both of which will be detected below. * both of which will be detected below.
@ -131,8 +130,7 @@ void conn_fd_handler(int fd)
* that we must absolutely test conn->xprt at each step in case it suddenly * that we must absolutely test conn->xprt at each step in case it suddenly
* changes due to a quick unexpected close(). * changes due to a quick unexpected close().
*/ */
if (conn->xprt && fd_recv_ready(fd) && if (conn->xprt && fd_recv_ready(fd)) {
((conn->flags & (CO_FL_XPRT_RD_ENA|CO_FL_WAIT_ROOM|CO_FL_ERROR|CO_FL_HANDSHAKE)) == CO_FL_XPRT_RD_ENA)) {
/* force reporting of activity by clearing the previous flags : /* force reporting of activity by clearing the previous flags :
* we'll have at least ERROR or CONNECTED at the end of an I/O, * we'll have at least ERROR or CONNECTED at the end of an I/O,
* both of which will be detected below. * both of which will be detected below.