diff options
author | Anand Avati <avati@gluster.com> | 2011-09-25 18:34:14 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-09-25 18:45:12 +0530 |
commit | b894944857a7ce61a3bd31566d6169ed8d19ce8b (patch) | |
tree | a0bdd8d751f8adf8e527715ea1d4ad40edf1cc22 | |
parent | 76580479033087f6dde080c27618baf19b18b658 (diff) |
rpc: fix wrong wiping of state machine's state
The macro __socket_proto_read() is used to read one sub-header in a fragment
after another. It also has to 'get out' of the state machine's
switch/case construct in two situations -
a) finished reading the full header
b) after a partial read, (and return in the same state at next pollin)
The 'reset' of the state should happen only after a full read of the header
and not if there was a partial read of the header.
Change-Id: I3650a83e1fae0f317cfd1b549835c72e39dc5253
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 00adc6def..089afb573 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -82,7 +82,7 @@ priv->incoming.frag.bytes_read += bytes_read; \ \ if ((ret > 0) || (priv->incoming.frag.remaining_size != 0)) { \ - if (priv->incoming.frag.remaining_size != 0) { \ + if (priv->incoming.frag.remaining_size != 0 && ret == 0) { \ __socket_proto_reset_pending (priv); \ } \ \ |