anchor.diff:  % ------------------------------------------
   
   cmd(?QUIT, _Sess, _Sock, _Out, _HE) ->
  -    exit(quit);
  +    exit({ok, quit_received});
   cmd(?QUITQ, _Sess, _Sock, _Out, _HE) ->
  -    exit(quit);
  +    exit({ok, quit_received}).
   
   % ------------------------------------------
   
  
positive.code: % ?SASL_AUTH
  % ?SASL_STEP
  % ?BUCKET
  
  % ------------------------------------------
  
  cmd(get, #session_proxy{bucket = Bucket} = Session,
      _InSock, Out, Keys) ->
      Groups =
          group_by(Keys,
                   fun (Key) ->
                       {Key, Addr} = mc_bucket:choose_addr(Bucket, Key),
                       Addr
                   end),
      {NumFwd, Monitors} =
          lists:foldl(fun ({Addr, AddrKeys}, Acc) ->
                          accum(forward(Addr, Out, get, AddrKeys), Acc)
                      end,
                      {0, []}, Groups),
      await_ok(NumFwd),
      mc_ascii:send(Out, <<"END\r\n">>),
      mc_downstream:demonitor(Monitors),
      {ok, Session};
  
  cmd(set, Session, InSock, Out, CmdArgs) ->
      forward_update(set, Session, InSock, Out, CmdArgs);
  cmd(add, Session, InSock, Out, CmdArgs) ->
      forward_update(add, Session, InSock, Out, CmdArgs);
  cmd(replace, Session, InSock, Out, CmdArgs) ->
      forward_update(replace, Session, InSock, Out, CmdArgs);
  cmd(append, Session, InSock, Out, CmdArgs) ->
      forward_update(append, Session, InSock, Out, CmdArgs);
  cmd(prepend, Session, InSock, Out, CmdArgs) ->
      forward_update(prepend, Session, InSock, Out, CmdArgs);
  
  cmd(incr, Session, InSock, Out, CmdArgs) ->
      forward_arith(incr, Session, InSock, Out, CmdArgs);
  cmd(decr, Session, InSock, Out, CmdArgs) ->
      forward_arith(decr, Session, InSock, Out, CmdArgs);
  
  cmd(delete, #session_proxy{bucket = Bucket} = Session,
      _InSock, Out, [Key]) ->
      {Key, Addr} = mc_bucket:choose_addr(Bucket, Key),
      {ok, Monitor} = forward(Addr, Out, delete, #mc_entry{key = Key}),
      case await_ok(1) of
          1 -> true;
          _ -> mc_ascii:send(Out, <<"ERROR\r\n">>)
      end,
      mc_downstream:demonitor([Monitor]),
      {ok, Session};
  
  cmd(flush_all, #session_proxy{bucket = Bucket} = Session,
      _InSock, Out, _CmdArgs) ->
      Addrs = mc_bucket:addrs(Bucket),
      {NumFwd, Monitors} =
          lists:foldl(fun (Addr, Acc) ->
                          % Using undefined Out to swallow the OK
                          % responses from the downstreams.
                          % TODO: flush_all arguments.
                          accum(forward(Addr, undefined,
                                        flush_all, #mc_entry{}), Acc)
                      end,
                      {0, []}, Addrs),
      await_ok(NumFwd),
      mc_ascii:send(Out, <<"OK\r\n">>),
      mc_downstream:demonitor(Monitors),
      {ok, Session};
  
  cmd(quit, _Session, _InSock, _Out, _Rest) ->
      exit({ok, quit_received}).
  
  % ------------------------------------------
  
  
negative.code:     end;
  await_ok(_, Acc) -> Acc.
  
  
  