Skip to content

Commit

Permalink
Fixed off-by-one error in enforcing W/R
Browse files Browse the repository at this point in the history
  • Loading branch information
lethain committed Dec 2, 2009
1 parent 7a5dc77 commit 0519d76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kvs.erl
Expand Up @@ -85,7 +85,7 @@ store(Store = #kvs_store{data=Data, pending_reads=Reads, pending_writes=Writes})
store(Store);
{_Sender, retrieved, Client, Key, Value} ->
case proplists:get_value({Client, Key}, Reads) of
{1, Values, _Timestamp} ->
{0, Values, _Timestamp} ->
Freq = lists:foldr(fun(X, Acc) ->
case proplists:get_value(X, Acc) of
undefined -> [{X, 1} | Acc];
Expand Down Expand Up @@ -118,7 +118,7 @@ store(Store = #kvs_store{data=Data, pending_reads=Reads, pending_writes=Writes})
case Count of
undefined ->
store(Store);
1 ->
0 ->
Client ! {self(), received, {set, Key, Value}},
store(Store#kvs_store{
pending_writes=proplists:delete({Key, Value}, Writes)});
Expand Down

0 comments on commit 0519d76

Please sign in to comment.