From: Yunkai Zhang <[email protected]>

We found that in some case, sheep will crash when going to delete
conn.blocking_siblings, because this list is empty. So we should
use list_empty() to check it safely.

Signed-off-by: Yunkai Zhang <[email protected]>
---
 sheep/sdnet.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index f69ec98..16c58bb 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -670,7 +670,7 @@ static void client_handler(int fd, int events, void *data)
                client_tx_handler(ci);
 
        if (is_conn_dead(&ci->conn)) {
-               if (!(ci->conn.events & EPOLLIN))
+               if (!list_empty(&ci->conn.blocking_siblings))
                        list_del(&ci->conn.blocking_siblings);
 err:
                dprintf("closed connection %d, %s:%d\n", fd,
-- 
1.7.10.2

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to