[sheepdog] [PATCH 3/4] sheep: take truns to monitor EPOLLIN and EPOLLOUT events.

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


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

When both EPOLLIN and EPOLLOUT events occur, client_hander() will always
process EPOLLIN event firstly, but this is not reasonable in some case.

The simplest way to fix this problem is that, let sheep take truns to
monitor EPOLLIN and EPOLLIUT events.

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

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 16c58bb..b75e52e 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -500,6 +500,7 @@ static void client_rx_handler(struct client_info *ci)
 		return;
 
 	/* now we have a complete command */
+	conn_rx_off(&ci->conn);
 
 	req = ci->rx_req;
 
@@ -549,6 +550,7 @@ again:
 	init_tx_hdr(ci);
 	if (!ci->tx_req) {
 		conn_tx_off(&ci->conn);
+		conn_rx_on(&ci->conn);
 		if (sys->outstanding_data_size < MAX_OUTSTANDING_DATA_SIZE) {
 			list_for_each_entry_safe(conn, n, &sys->blocking_conn_list,
 						 blocking_siblings) {
-- 
1.7.10.2




More information about the sheepdog mailing list