anchor.diff:    inject(RemoteIp, Ip, Data),
     ok.
   
  -fin_callouts(Ss, [_Ip, _Port, _RemoteIp, _RemotePort, _Seq, _, Id]) ->
  -  [ S ] = [ S || S<-Ss, S#socket.id == Id ],
  +fin_callouts(S, [_Ip, _Port, _RemoteIp, _RemotePort, _Seq, _, Id]) ->
  +  Sock = get_socket(S, Id),
     ?INC(Id, rseq),
     ?APPLY(sent_ack, [Id]),
  -  case S#socket.tcp_state of
  +  case Sock#socket.tcp_state of
       established ->
         ?SET(Id, tcp_state, close_wait);
       fin_wait_1 ->
  -      case S#socket.seq == S#socket.rcvd of %% FIN+ACK ?
  +      case Sock#socket.seq == Sock#socket.rcvd of %% FIN+ACK ?
           true ->
             ?UNBLOCK({close, Id}, ok),
             ?SET(Id, tcp_state, time_wait);
  
positive.code: accept_callouts(S, [_Socket, Id]) ->
    case [ Sock || Sock <- S#state.sockets,
                   Sock#socket.parent == Id,
                   Sock#socket.tcp_state == established,
                   Sock#socket.socket == undefined ] of
      [Sock | _] ->
        NewId = Sock#socket.id,
  
negative.code: 
  close_callouts(S, [_, Id]) ->
    Sock = get_socket(S, Id),
    case Sock#socket.socket_type of
      listen ->
        ?PAR([ ?UNBLOCK({accept, Pid}, closed) || Pid <- Sock#socket.accepts ] ++
             [ ?APPLY(do_close, [Child#socket.id]) || 
               Child <- S#state.sockets, Child#socket.parent == Id,
               Child#socket.socket == undefined ]),  
        ?APPLY(reset, [Id]);
      _ ->
        ?APPLY(do_close, [Id]),
        ?BLOCK({close, Id}) 
    end.
  
  close_process(_, _) -> spawn.
  
  do_close_callouts(S, [Id]) ->
    Sock = get_socket(S, Id),
    case Sock#socket.tcp_state of
      close_wait -> 
        ?APPLY(sent_fin, [Id]),
        ?SET(Id, tcp_state, last_ack);
      established -> 
        ?APPLY(sent_fin, [Id]),
        ?SET(Id, tcp_state, fin_wait_1);
      _ ->
        ?EMPTY
    end.
  
  %% -- Backend operations -----------------------------------------------------
  
  