summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2014-07-18 14:58:23 -0400
committerRobert Newson <rnewson@apache.org>2014-08-07 12:33:09 +0100
commit535941d94d3e2d05f5ec31d2ff8f65c4149cc1da (patch)
tree23b792cdcbd781cf7cf6fbaf9542138f8fda41e8
parent096f0cfb1a6f85880685b7b65d44f00a582436d3 (diff)
downloadcouchdb-535941d94d3e2d05f5ec31d2ff8f65c4149cc1da.tar.gz
Allow for timeout message while waiting for sender
In 9c36c1b0 we fixed counting bug in the bufffer but introduced another one. We started asserting that the timeout message can only arrive when the sender is not nil, but in fact it can absolutely happen that the buffer is asked to deliver a message while one is in flight. This causes the rexi_buffer to crash. The fix is to simply restore the clause that ignores the timeout message if the server is waiting for a sender to return. BugzID: 32669
-rw-r--r--src/rexi_buffer.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rexi_buffer.erl b/src/rexi_buffer.erl
index 42b4ef27d..0ba961ab9 100644
--- a/src/rexi_buffer.erl
+++ b/src/rexi_buffer.erl
@@ -78,6 +78,9 @@ handle_info(timeout, #state{sender = nil, count = C} = State) when C > 0 ->
Sender = spawn_monitor(erlang, send, [Dest, Msg]),
{noreply, NewState#state{sender = Sender}}
end;
+handle_info(timeout, State) ->
+ % Waiting on a sender to return
+ {noreply, State};
handle_info({'DOWN', Ref, _, Pid, _}, #state{sender = {Pid, Ref}} = State) ->
{noreply, State#state{sender = nil}, 0}.