anchor.diff:      {reply, Reply, State#state{mode = proplists:get_value(mode, Options, Mode)}};
   
   handle_call({controlling_process, undefined, {Old, New}}, _From, State = #state{owner = Old}) ->
  +    unlink(Old),
  +    link(New),
       {reply, ok, State#state{owner = New}};
   handle_call({controlling_process, undefined, _}, _From, State) ->
       {reply, {error, not_owner}, State};
  
positive.code: %%===================================================================
  
  -record(state, {socket, owner, mode, state = init, accepting, connections, virtual_sockets}).
  -record(capwap_socket, {id, type, peer, owner, mode, queue}).
  
  init([Owner, Port, Options0]) ->
      process_flag(trap_exit, true),
  
negative.code: socket_peername(#capwap_socket{peer = Peer}, _, _From, State) ->
      {reply, {ok, Peer}, State}.
  
  socket_controlling_process(CSocket = #capwap_socket{owner = Old, monitor = OldMonRef}, {Old, Pid}, _From, State0) ->
      catch(demonitor(process, OldMonRef)),
      MonRef = monitor(process, Pid),
      State = update_csocket(CSocket#capwap_socket{owner = Pid, monitor = MonRef}, State0),
      {reply, ok, State};
  socket_controlling_process(_, _, _From, State) ->
      {reply, {error, not_owner}, State}.
  
  socket_owner_down(_Pid, none, State) ->
      State;
  socket_owner_down(Pid, {_Key, VSocket = #capwap_socket{owner = Pid}, _Iter}, State) ->
      delete_csocket(VSocket, State);
  socket_owner_down(Pid, {_Key, _Value, Iter}, State) ->
      socket_owner_down(Pid, gb_trees:next(Iter), State).
  
  %% =====================================================================================
  
  