anchor.diff:      {block, maybe_reply_setup_streams(NewState#state{state = NewStreamState})};
   
   handle_packet(response, ?UPR_ADD_STREAM, Packet,
  -              #state{state = #takeover_state{owner = From}}
  -              = State, _ParentState) ->
  +              #state{state = #takeover_state{owner = From, partition = Partition, open_ack = false}
  +                     = TakeoverState} = State, _ParentState) ->
   
       {Header, Body} = mc_binary:decode_packet(Packet),
  -    case upr_commands:process_response(Header, Body) of
  -        {ok, _Opaque} ->
  -            {block, State};
  -        Error ->
  +    case {upr_commands:process_response(Header, Body), Header#mc_header.opaque} of
  +        {{ok, _}, Partition} ->
  +            NewTakeoverState = TakeoverState#takeover_state{open_ack = true},
  +            {block, maybe_reply_takeover(From, NewTakeoverState, State)};
  +        {Error, Partition} ->
               gen_server:reply(From, Error),
  -            {block, State#state{state = idle}}
  +            {block, State#state{state = idle}};
  +        {_, WrongOpaque} ->
  +            ?rebalance_error("Unexpected response. Unrecognized opaque ~p~nHeader: ~p~nPartition: ~p",
  +                             [WrongOpaque, Header, Partition]),
  +            erlang:error({unrecognized_opaque, WrongOpaque, Partition})
       end;
   
   handle_packet(request, ?UPR_STREAM_REQ, Packet,
  
positive.code:                              [Partition, mc_client_binary:vbucket_state_to_atom(VbState)]),
              case VbState of
                  ?VB_STATE_ACTIVE ->
                      gen_server:reply(From, ok),
                      {proxy, State#state{state = idle}};
                  _ ->
                      {proxy, State#state{state =
                                              TakeoverState#takeover_state{
  
negative.code:             State
      end.
  
  maybe_reply_takeover(From, #takeover_state{open_ack = true, state = active}, State) ->
      gen_server:reply(From, ok),
      State#state{state = idle};
  maybe_reply_takeover(_From, TakeoverState, State) ->
      State#state{state = TakeoverState}.
  
  setup_streams(Pid, Partitions) ->
      gen_server:call(Pid, {setup_streams, Partitions}, infinity).
  
  