anchor.diff:         [S#state.socket, S#state.id]).
   
   close_pre(Ss, [Socket, Id]) ->
  -  [ S ] = [ S || S<-Ss, S#state.id == Id ],
  -  S#state.socket == Socket andalso
  -    in_tcp_state(Ss, Id, [established, close_wait, listen]) andalso
  -    lists:member(S#state.socket_type, [accept, connect]).
  +  case [ S || S<-Ss, S#state.id == Id ] of
  +    [ S ] ->
  +      S#state.socket == Socket andalso
  +        in_tcp_state(Ss, Id, [established, close_wait, listen]) andalso
  +        lists:member(S#state.socket_type, [accept, connect, listen]);
  +    _ ->
  +      false
  +  end.
   
   closet_adapt(Ss, [_, Id]) -> 
  -  [ S ] = [ S || S<-Ss, S#state.id == Id ],
  -  [S#state.socket, Id].
  +  case [ S || S<-Ss, S#state.id == Id ] of
  +    [ S ] ->
  +      [S#state.socket, Id];
  +    _ ->
  +      false
  +  end.
   
   close(Socket, _) ->
     Root = self(),
  
positive.code:         S#state.rport, uint32(), S#state.seq, S#state.id]).
  
  syn_ack_pre(Ss, [Ip, Port, RIp, RPort, _, Seq, Id]) ->
    [ S ] = [ S || S<-Ss, S#state.id == Id ],
    in_tcp_state(Ss, Id, syn_sent) andalso
      S#state.rcvd == S#state.seq andalso
      Ip    == S#state.ip    andalso
      Port  == S#state.port  andalso
      RIp   == S#state.rip   andalso
      RPort == S#state.rport andalso
      Seq   == S#state.seq.
  
  syn_ack_adapt(Ss, [_, _, _, _, Seq, _, Id]) ->
    [ S ] = [ S || S<-Ss, S#state.id == Id ],
    [S#state.ip, S#state.port, S#state.rip,
     S#state.rport, Seq, S#state.seq, Id].
  
  syn_ack(Ip, Port, RemoteIp, RemotePort, Seq, Ack, _) ->
    Packet =
  
negative.code:     in_tcp_state(Ss, Id, [listen, syn_rcvd, established, close_wait]).
  
  accept_adapt(Ss, [_, Id]) -> 
   case  [ S || S<-Ss, S#state.id == Id ] of
     [S] ->
       [S#state.socket, Id];
     _ ->
       false
   end.
  
  accept(Socket, _) ->
    mock:set_socket(tcp_con:usr_accept(Socket)).
  