anchor.diff:  %%===================================================================
   
   -record(state, {socket, owner, mode, state = init, accepting, connections, virtual_sockets}).
  --record(capwap_socket, {id, type, peer, owner, mode, queue}).
  +-record(capwap_socket, {id, type, peer, owner, monitor, mode, queue}).
   
   init([Owner, Port, Options0]) ->
       process_flag(trap_exit, true),
  
positive.code: 	        State = #state{virtual_sockets = VSockets}) ->
      State#state{virtual_sockets = gb_trees:update(CSocketId, CSocket, VSockets)}.
  
  delete_csocket(#capwap_socket{id = CSocketId, type = Type, peer = Peer},
  	       State =
  		   #state{connections = Connections, virtual_sockets = VSockets}) ->
      State#state{
        connections = gb_trees:delete_any({Peer, Type}, Connections),
        virtual_sockets = gb_trees:delete_any(CSocketId, VSockets)}.
  
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).
  
  %% =====================================================================================
  
  