diff options
author | Raghavendra G <raghavendra@gluster.com> | 2010-08-17 23:58:37 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-18 00:37:08 -0700 |
commit | 0b890833c8cba9bac71877e528d810eba91dd1e6 (patch) | |
tree | e180e57fbc059108bf58e08b337b38f4bcbe3d38 | |
parent | 4e01a54eaa6da1bd6817d62dcc51a75e22699e2b (diff) |
rpc: add rpc_req structure to request_info structure, used by transport layer to get corresponding request to reply received.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 875 (Implement a new protocol to provide proper backward/forward compatibility)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=875
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 21 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 4 |
2 files changed, 11 insertions, 14 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index bac8b0246a8..eac9f875066 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -26,6 +26,7 @@ #define RPC_CLNT_DEFAULT_REQUEST_COUNT 4096 #include "rpc-clnt.h" +#include "byte-order.h" #include "xdr-rpcclnt.h" #include "rpc-transport.h" #include "protocol-common.h" @@ -427,6 +428,7 @@ rpc_clnt_fill_request_info (struct rpc_clnt *clnt, rpc_request_info_t *info) info->prognum = saved_frame.rpcreq->prog->prognum; info->procnum = saved_frame.rpcreq->procnum; info->progver = saved_frame.rpcreq->prog->progver; + info->rpc_req = saved_frame.rpcreq; info->rsp = saved_frame.rsp; ret = 0; @@ -657,33 +659,24 @@ rpc_clnt_handle_reply (struct rpc_clnt *clnt, rpc_transport_pollin_t *pollin) { rpc_clnt_connection_t *conn = NULL; struct saved_frame *saved_frame = NULL; - rpc_request_info_t *request_info = NULL; int ret = -1; struct rpc_req *req = NULL; + uint32_t xid = 0; conn = &clnt->conn; - request_info = pollin->private; - - saved_frame = lookup_frame (conn, (int64_t)request_info->xid); + xid = ntoh32 (*((uint32_t *)pollin->vector[0].iov_base)); + saved_frame = lookup_frame (conn, xid); if (saved_frame == NULL) { gf_log ("rpc-clnt", GF_LOG_CRITICAL, "cannot lookup the " - "saved frame for reply with xid (%d), " - "prog-version (%d), prog-num (%d)," - "procnum (%d)", request_info->xid, - request_info->progver, request_info->prognum, - request_info->procnum); + "saved frame for reply with xid (%d)", xid); goto out; } req = saved_frame->rpcreq; if (req == NULL) { gf_log ("rpc-clnt", GF_LOG_CRITICAL, - "saved_frame for reply with xid (%d), " - "prog-version (%d), prog-num (%d), procnum (%d)" - "does not contain rpc-req", request_info->xid, - request_info->progver, request_info->prognum, - request_info->procnum); + "saved_frame for reply with xid (%d)", xid); goto out; } diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index a6a3441dcdd..c5b6f382e7b 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -146,11 +146,15 @@ struct rpc_transport_data { }; typedef struct rpc_transport_data rpc_transport_data_t; +/* FIXME: prognum, procnum and progver are already present in + * rpc_request, hence these should be removed from request_info + */ struct rpc_request_info { uint32_t xid; int prognum; int progver; int procnum; + void *rpc_req; /* struct rpc_req */ rpc_transport_rsp_t rsp; }; typedef struct rpc_request_info rpc_request_info_t; |