anchor.diff:  -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
            terminate/2, code_change/3]).
   
  --record(state, {address, port, sock, hello, req, ctx, from, queue}).
  +-record(state, {address, port, sock, hello, pending, queue}).
  +-record(request, {ref :: reference(), msg :: rpb_req(), from, ctx :: ctx(), tref}).
   
   -define(PROTO_MAJOR, 1).
   -define(PROTO_MINOR, 0).
  
positive.code: %% ====================================================================
  %% internal functions
  %% ====================================================================
  
  default_timeout(_Op) ->
      60000.
  
negative.code:     ReqId = mk_reqid(),
      gen_server:call(Pid, {req, ReqMsg, default_timeout(mapred), {ReqId, ClientPid}}).
  
  %% @private
  %% Make a new request that can be sent or queued
  new_request(Msg, From, _Timeout) ->
      #request{ref = make_ref(), msg = Msg, from = From}.
  new_request(Msg, From, _Timeout, Context) ->
      #request{ref = make_ref(), msg = Msg, from = From, ctx = Context}.
  
  %% Send a request to the server and prepare the state for the response
  %% @private
  send_request(Request, State) when State#state.pending =:= undefined ->
      Pkt = riakc_pb:encode(Request#request.msg),
      gen_tcp:send(State#state.sock, Pkt),
      maybe_reply(after_send(Request, State#state{pending = Request})).
  
  %% Queue up a request if one is pending
  %% @private
  queue_request(Pending, State) ->
      State#state{queue = queue:in(Pending, State#state.queue)}.
  
  %% Try and dequeue request and send onto the server if one is waiting
  %% @private
  