You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2010/06/12 18:43:21 UTC

svn commit: r954030 - /couchdb/branches/0.10.x/src/couchdb/couch_rep_reader.erl

Author: kocolosk
Date: Sat Jun 12 16:43:21 2010
New Revision: 954030

URL: http://svn.apache.org/viewvc?rev=954030&view=rev
Log:
backport fix for #1 in COUCHDB-793

Modified:
    couchdb/branches/0.10.x/src/couchdb/couch_rep_reader.erl

Modified: couchdb/branches/0.10.x/src/couchdb/couch_rep_reader.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_rep_reader.erl?rev=954030&r1=954029&r2=954030&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_rep_reader.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_rep_reader.erl Sat Jun 12 16:43:21 2010
@@ -98,6 +98,8 @@ code_change(_OldVsn, State, _Extra) ->
 
 %internal funs
 
+handle_add_docs(_Seq, [], _From, State) ->
+    {reply, ok, State};
 handle_add_docs(Seq, DocsToAdd, From, #state{reply_to=nil} = State) ->
     State1 = update_sequence_lists(Seq, State),
     NewState = State1#state{
@@ -141,9 +143,13 @@ handle_open_remote_doc(Id, Seq, Revs, _,
     {_, _Ref} = spawn_document_request(Source, Id, Seq, Revs),
     {reply, ok, State#state{monitor_count = Count+1}}.
 
-handle_monitor_down(normal, #state{pending_doc_request=nil,
+handle_monitor_down(normal, #state{pending_doc_request=nil, reply_to=nil,
         monitor_count=1, complete=waiting_on_monitors} = State) ->
     {noreply, State#state{complete=true, monitor_count=0}};
+handle_monitor_down(normal, #state{pending_doc_request=nil, reply_to=From,
+        monitor_count=1, complete=waiting_on_monitors} = State) ->
+    gen_server:reply(From, {complete, calculate_new_high_seq(State)}),
+    {stop, normal, State#state{complete=true, monitor_count=0}};
 handle_monitor_down(normal, #state{pending_doc_request=nil} = State) ->
     #state{monitor_count = Count} = State,
     {noreply, State#state{monitor_count = Count-1}};