anchor.diff:      try
           Row = decode_row(Msg),
           case State of
  -        #state{reply_to=nil} ->
  -            {noreply, State#state{count=Count+1, rows = queue:in(Row, Rows)}};
  -        #state{count=0, reply_to=From}->
  +        #remote{reply_to=nil} ->
  +            {noreply, State#remote{count=Count+1, rows = queue:in(Row, Rows)}};
  +        #remote{count=0, reply_to=From}->
               gen_server:reply(From, Row),
  -            {noreply, State#state{reply_to=nil}}
  +            {noreply, State#remote{reply_to=nil}}
           end
       catch
       throw:{invalid_json, Msg} ->
  
positive.code:         {noreply, State}
      end;
  
  handle_info({ibrowse_async_response_end, Id}, #state{reqid=Id} = State) ->
      ?LOG_DEBUG("got ibrowse_async_response_end ~p", [State#state.reply_to]),
      case State of
      #state{reply_to=nil} ->
          {noreply, State#state{complete=true}};
      #state{count=0, reply_to=From}->
          gen_server:reply(From, complete),
          {stop, normal, State}
      end;
  
  handle_info(Msg, State) ->
      ?LOG_INFO("unexpected message ~p", [Msg]),
      {noreply, State}.
  
  terminate(_Reason, #state{conn=Pid}) when is_pid(Pid) ->
      catch ibrowse:stop_worker_process(Pid),
      ok;
  terminate(_Reason, _State) ->
  
negative.code: maybe_stream_next(_Complete, _Count, Id) ->
      ?LOG_DEBUG("~p reqid ~p not streaming", [?MODULE, Id]),
      ok.
  
  send_local_changes_forever(Server, DbName, Since) ->
      {ok, NewSeq} = send_local_changes_once(Server, DbName, Since),
      timer:sleep(5000),
      send_local_changes_forever(Server, DbName, NewSeq).
  
  send_local_changes_once(Server, DbName, Since) ->
      {ok, Db} = couch_db:open(DbName, []),
  
      FilterFun =
      fun(#doc_info{revs=[#rev_info{rev=Rev}|_]}) ->
          {[{<<"rev">>, couch_doc:rev_to_str(Rev)}]}
      end,
  
      ChangesFun =
      fun([#doc_info{id=Id, high_seq=Seq}|_]=DocInfos, _) ->
          Results0 = [FilterFun(DocInfo) || DocInfo <- DocInfos],
          Results = [Result || Result <- Results0, Result /= null],
          if Results /= [] ->
              Change = {[{<<"seq">>,Seq}, {<<"id">>,Id}, {<<"changes">>,Results}]},
              gen_server:call(Server, {add, Change}, infinity);
          true ->
              ?LOG_DEBUG("Results was empty ~p", [Results0]),
              ok
          end,
          {ok, Seq}
      end,
  
      couch_db:changes_since(Db, all_docs, Since, ChangesFun, Since).
  
  start_http_request(RawUrl) ->
      Url = ibrowse_lib:parse_url(RawUrl),
  