[sheepdog] [PATCH 2/3] sheep: don't send unnecessary data on error
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Fri Sep 7 09:45:27 CEST 2012
This will save network traffic in some cases.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/request.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sheep/request.c b/sheep/request.c
index ae12bd3..723666c 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -123,6 +123,7 @@ static int check_request_epoch(struct request *req)
/* ask gateway to retry. */
req->rp.result = SD_RES_OLD_NODE_VER;
req->rp.epoch = sys->epoch;
+ req->rp.data_length = 0;
put_request(req);
return -1;
} else if (after(req->rq.epoch, sys->epoch)) {
@@ -341,25 +342,30 @@ static void queue_request(struct request *req)
switch (sys->status) {
case SD_STATUS_KILLED:
rsp->result = SD_RES_KILLED;
+ rsp->data_length = 0;
goto done;
case SD_STATUS_SHUTDOWN:
rsp->result = SD_RES_SHUTDOWN;
+ rsp->data_length = 0;
goto done;
case SD_STATUS_WAIT_FOR_FORMAT:
if (!is_force_op(req->op)) {
rsp->result = SD_RES_WAIT_FOR_FORMAT;
+ rsp->data_length = 0;
goto done;
}
break;
case SD_STATUS_WAIT_FOR_JOIN:
if (!is_force_op(req->op)) {
rsp->result = SD_RES_WAIT_FOR_JOIN;
+ rsp->data_length = 0;
goto done;
}
break;
case SD_STATUS_HALT:
if (!is_force_op(req->op)) {
rsp->result = SD_RES_HALT;
+ rsp->data_length = 0;
goto done;
}
break;
--
1.7.2.5
More information about the sheepdog
mailing list