[sheepdog] [PATCH] sheep: reinitialize conn->blocking_siblings after delete it
Yunkai Zhang
yunkai.me at gmail.com
Thu Jun 28 05:54:10 CEST 2012
From: Yunkai Zhang <qiushu.zyk at taobao.com>
We use list_empty() to check whether conn->blocking_siblings has joined into
sys->blocking_conn_list, so it needs to be re-initialized after delete it from
blocking_conn_list.
Use list_del_init() instead of list_del() can achieve this purpose.
Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
sheep/sdnet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 85ac02f..7c96d52 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -615,7 +615,7 @@ again:
list_for_each_entry_safe(conn, n, &sys->blocking_conn_list,
blocking_siblings) {
dprintf("rx on %p\n", conn);
- list_del(&conn->blocking_siblings);
+ list_del_init(&conn->blocking_siblings);
conn_rx_on(conn);
}
}
@@ -736,7 +736,7 @@ static void client_handler(int fd, int events, void *data)
if (is_conn_dead(&ci->conn)) {
if (!list_empty(&ci->conn.blocking_siblings))
- list_del(&ci->conn.blocking_siblings);
+ list_del_init(&ci->conn.blocking_siblings);
err:
dprintf("closed connection %d, %s:%d\n", fd,
ci->conn.ipstr, ci->conn.port);
--
1.7.10.2
More information about the sheepdog
mailing list