[sheepdog] [PATCH 2/4] sheep: fix bug when delete conn.blocking_siblings

Yunkai Zhang yunkai.me at gmail.com
Sat Jun 23 15:40:33 CEST 2012


From: Yunkai Zhang <qiushu.zyk at taobao.com>

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 <qiushu.zyk at taobao.com>
---
 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




More information about the sheepdog mailing list