diff options
author | Raghavendra G <raghavendra@gluster.com> | 2010-10-12 03:54:31 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-12 03:04:05 -0700 |
commit | b9d6e0c879feb9d86cdadf4072a7ebeb5eb29798 (patch) | |
tree | dfeda2fd13ce9669d4da5804916d01e5da6ccefb | |
parent | a6304aec8c366ad7853f95348aa6c73a0b873678 (diff) |
rpc-transport/socket: initialize fragcurrent pointer in correct state while reading vectored replies.
- If fragcurrent is initialized in the same state which reads payload data,
there is a possibility of it getting reset during partial reads from socket.
Hence it should be initialized just before entering the state which reads
payload data.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1929 (different value is logged for read header size for multiple reads)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1929
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 6289e75592b..00b7dd5e56a 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1024,9 +1024,6 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this) priv->incoming.frag.call_body.reply.accepted_success_state = SP_STATE_READ_PROC_HEADER; - /* fall through */ - - case SP_STATE_READ_PROC_HEADER: if (priv->incoming.payload_vector.iov_base == NULL) { iobuf = iobuf_get (this->ctx->iobuf_pool); if (iobuf == NULL) { @@ -1053,6 +1050,9 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this) priv->incoming.frag.fragcurrent = priv->incoming.payload_vector.iov_base; + /* fall through */ + + case SP_STATE_READ_PROC_HEADER: /* now read the entire remaining msg into new iobuf */ ret = __socket_read_simple_msg (this); if ((ret == -1) |