[sheepdog] [PATCH 4/4] sheep: fix bug that blocking_conn_list could never be processed

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


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

In client_tx_handler(), when the program goto again, ci->tx_req will be
re-initialized, so it's value would be always not NULL, and then
sys->blocking_conn_list could never be processed.

We sould not call init_tx_hdr(), when goto again.

BTW: adds some code to help us debuging.

Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
 sheep/sdnet.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index b75e52e..190d8de 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -546,8 +546,9 @@ static void client_tx_handler(struct client_info *ci)
 	int ret, opt;
 	struct sd_rsp *rsp = (struct sd_rsp *)&ci->conn.tx_hdr;
 	struct connection *conn, *n;
-again:
+
 	init_tx_hdr(ci);
+again:
 	if (!ci->tx_req) {
 		conn_tx_off(&ci->conn);
 		conn_rx_on(&ci->conn);
@@ -598,6 +599,8 @@ again:
 	if (ci->conn.c_tx_state == C_IO_END) {
 		free_request(ci->tx_req);
 		ci->tx_req = NULL;
+		dprintf("connection from: %s:%d\n", ci->conn.ipstr,
+			ci->conn.port);
 		goto again;
 	}
 }
-- 
1.7.10.2




More information about the sheepdog mailing list