Browse files

Merge pull request #11 from gchaincl/master

concurrent mget bug for non existing keys
  • Loading branch information...
2 parents 950c3eb + 50af495 commit 32d5d8496999520605e6f5cf4c6c0f99ef982bba @cstar committed Apr 14, 2012
Showing with 11 additions and 15 deletions.
  1. +11 −15 src/erldis_client.erl
View
26 src/erldis_client.erl
@@ -430,21 +430,17 @@ parse_state(State, Socket, Data) ->
State#redis{remaining=Remaining, pstate=read};
{N, {read, nil}} ->
% reply with nil
- case State#redis.pstate of
- empty -> send_reply(State#redis{buffer=[nil]});
- read -> NewBuffer = [nil | State#redis.buffer],
- NewState =
- State#redis{remaining=N,
- buffer=NewBuffer,
- pstate=read},
- case N of
- 0 -> send_reply(NewState);
- _ -> NewState
- end
- end;
- {_, {read, 0}} when State#redis.pstate =:= empty ->
- % this is needed to handle single-line reply empty responses
- send_reply(State#redis{buffer=[]});
+ case State#redis.pstate of
+ empty -> send_reply(State#redis{buffer=[nil]});
+ read -> NewBuffer = [nil | State#redis.buffer],
+ case N of
+ 0 -> send_reply(State#redis{buffer = NewBuffer});
+ _ -> State#redis{remaining=N, buffer=NewBuffer, pstate=read}
+ end
+ end;
+ {_, {read, 0}} when State#redis.pstate =:= empty ->
+ % this is needed to handle single-line reply empty responses
+ send_reply(State#redis{buffer=[]});
{0, {read, NBytes}} ->
% reply with Value added to buffer
Value = recv_value(Socket, NBytes),

0 comments on commit 32d5d84

Please sign in to comment.