[sheepdog] [PATCH] gateway: fix segment fault when closing all connections incorrectly.

Liu Yuan namei.unix at gmail.com
Fri Feb 1 03:24:33 CET 2013


From: Liu Yuan <tailai.ly at taobao.com>

We should directly call sheep_del_sockfd() to destroy all the connections or
memmove will cause segment fault.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/gateway.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/gateway.c b/sheep/gateway.c
index 7f99c20..40eb56c 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -175,7 +175,7 @@ again:
 		nr_sent = wi->nr_sent;
 		/* XXX Blinedly close all the connections */
 		for (i = 0; i < nr_sent; i++)
-			finish_one_write_err(wi, i);
+			sheep_del_sockfd(wi->ent[i].nid, wi->ent[i].sfd);
 
 		err_ret = SD_RES_NETWORK_ERROR;
 		goto finish_write;
-- 
1.7.9.5




More information about the sheepdog mailing list