From 497532ef7e5c4361ac6c2c76fe5f2d209b986953 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Tue, 5 Jun 2012 13:45:39 -0700 Subject: rpc-transport/socket: fix the state machine for XDATA reading The socket state machine was broken for reading XDATA on the server. This code was structured such that when there was a partial read in a particular state, some variables would remain uninitialized in the next 'run' of the state machine. Also did some re-org of the state machine with two more states to make the code more readable and similar in state-breakup pattern to the other states. Change-Id: Ia32c78d4b9567bb08c6df8dc9fd6f05749d312a4 BUG: 829062 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.com/3524 Reviewed-by: Amar Tumballi Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- rpc/rpc-transport/socket/src/socket.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rpc/rpc-transport/socket/src/socket.h') diff --git a/rpc/rpc-transport/socket/src/socket.h b/rpc/rpc-transport/socket/src/socket.h index 6d6802a541f..0304f1db1eb 100644 --- a/rpc/rpc-transport/socket/src/socket.h +++ b/rpc/rpc-transport/socket/src/socket.h @@ -72,6 +72,12 @@ typedef enum { SP_STATE_READ_VERFBYTES, /* read verifier data */ SP_STATE_READING_PROGHDR, SP_STATE_READ_PROGHDR, + SP_STATE_READING_PROGHDR_XDATA, + SP_STATE_READ_PROGHDR_XDATA, /* It's a bad "name" in the generic + RPC state machine, but greatly + aids code review (and xdata is + the only "consumer" of this state) + */ SP_STATE_READING_PROG, } sp_rpcfrag_vectored_request_state_t; @@ -165,6 +171,7 @@ typedef struct { sp_rpcfrag_simple_msg_state_t simple_state; sp_rpcfrag_state_t state; } frag; + char *proghdr_base_addr; struct iobuf *iobuf; size_t iobuf_size; struct iovec vector[2]; -- cgit