From: Liu Yuan <tailai.ly at taobao.com> We shouldn't reset the header if it is the last try or the response will get a wrong err code in failure. Signed-off-by: Liu Yuan <tailai.ly at taobao.com> --- sheep/gateway.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sheep/gateway.c b/sheep/gateway.c index 27660f1..cda1309 100644 --- a/sheep/gateway.c +++ b/sheep/gateway.c @@ -89,9 +89,11 @@ read_remote: eprintf("remote read fail %x\n", ret); sheep_put_sockfd(&v->nid, sfd); } - /* Reset the hdr for next read */ - memcpy(&fwd_hdr, &req->rq, sizeof(fwd_hdr)); - fwd_hdr.flags |= SD_FLAG_CMD_IO_LOCAL; + if (i + 1 != nr_copies) { + /* Reset the hdr for next read */ + memcpy(&fwd_hdr, &req->rq, sizeof(fwd_hdr)); + fwd_hdr.flags |= SD_FLAG_CMD_IO_LOCAL; + } } return ret; } -- 1.7.10.2 |