anchor.diff:    Sock = get_socket(S, Id),
     ?PAR([ ?UNBLOCK({close, Pid}, ok) || Pid <- Sock#socket.blocked ]).
   
  +upd_next(S, _, [Id, Key, Fun]) ->
  +  Sock = get_socket(S, Id),
  +  set_socket(S, Id, setelement(Key, Sock, Fun(element(Key, Sock)))).
   
   set_next(S, _, [Id, Key, Value]) ->
     Sock = get_socket(S, Id),
  
positive.code:   end.
  
  accept_callouts(S, [_Socket, Id]) ->
    case [ Sock || Sock <- S#state.sockets,
                   Sock#socket.parent == Id,
                   lists:member(Sock#socket.tcp_state, [established, close_wait]),
                   Sock#socket.socket == undefined ] of
      [Sock | _] ->
        NewId = Sock#socket.id,
        ?APPLY(set_socket, [NewId]);
      [] ->
        Sock = get_socket(S, Id),
        ?SET(Id, blocked, Sock#socket.blocked ++ [?SELF]),
        ?MATCH(NewId, ?BLOCK({accept, ?SELF})),
        ?WHEN(NewId /= closed, ?APPLY(set_socket, [NewId]))
  
negative.code: 
  -define(SET(Id, Key, Value), ?APPLY(set, [Id, #socket.Key, Value])).
  -define(INC(Id, Key),        ?APPLY(inc, [Id, #socket.Key])).
  -define(UPD(Id, Key, Pat, Body),
    ?APPLY(upd, [Id, #socket.Key, fun(Pat) -> Body end])).
  
  -define(MAX_SOCKETS, 5).
  
  -record(socket,{tcp_state = undefined, ip, port, rip, rport, socket,
                 socket_type, seq, rcvd, rseq, id, parent, blocked = [],
                 accept_queue = []}).
  
  -record(state, {ip, sockets = []}).
  
  