anchor.diff:                          [{timeout, infinity}]).
   
   
  --spec init({address(), port_number()}) ->
  -            {ok, #state{}} | {stop, {error, file:posix()}}.
  +-spec init({address(), port_number()}) -> {ok, #state{}}.
   %% @private
   init({Address, Port}) ->
  -  case gen_tcp:connect(Address, Port, [binary, {packet, fcgi}]) of
  -    {ok, Socket} -> {ok, initial_state(Socket)};
  -    Error = {error, _Reason} -> {stop, Error} end.
  +  {ok, initial_state(Address, Port)}.
   
   -spec handle_call({begin_request, role(), [param()]}, {pid(), reference()},
                     #state{}) ->
  -                   {reply, {ok, reference()}, #state{}};
  +                   {reply, {ok, reference()}, #state{}} |
  +                   {stop, file:posix(), {error, file:posix()}, #state{}};
                    ({send, reference(), binary()}, term(), #state{}) ->
  -                   {reply, ok | {error, not_found}, #state{}};
  +                   {reply, ok | {error, not_found}, #state{}} |
  +                   {stop, file:posix(), {error, file:posix()}, #state{}};
                    ({end_request, reference()}, term(), #state{}) ->
  -                   {reply, ok | {error, not_found}, #state{}}.
  +                   {reply, ok | {error, not_found}, #state{}} |
  +                   {stop, file:posix(), {error, file:posix()}, #state{}}.
   %% @private
   handle_call({begin_request, Role, Params}, {Pid, _Tag}, State) ->
  -  {ReqId, NewState} = next_req_id(State),
  -  send_packets([{fcgi_begin_request, ReqId, Role, keepalive},
  -                {fcgi_params, ReqId, ex_fcgi_protocol:encode_params(Params)},
  -                {fcgi_params, ReqId, <<>>}],
  -               NewState),
  -  Ref = erlang:monitor(process, Pid),
  -  insert({ReqId, Ref, Pid}, NewState),
  -  {reply, {ok, Ref}, NewState};
  +  {ReqId, State1} = next_req_id(State),
  +  case send_packets([{fcgi_begin_request, ReqId, Role, keepalive},
  +                     {fcgi_params, ReqId,
  +                      ex_fcgi_protocol:encode_params(Params)},
  +                     {fcgi_params, ReqId, <<>>}], State1) of
  +    {ok, State2} ->
  +      Ref = erlang:monitor(process, Pid),
  +      insert({ReqId, Ref, Pid}, State2),
  +      {reply, {ok, Ref}, State2};
  +    Error = {error, Reason} ->
  +      {stop, Reason, Error, State1} end;
   handle_call({send, Ref, Data}, _From, State) when byte_size(Data) =/= 0 ->
     handle_send(Ref, Data, State);
   handle_call({end_request, Ref}, _From, State) ->
  
positive.code:   do_abort(Ref, State),
    {noreply, State};
  handle_info({tcp_closed, Socket}, State = #state{socket = Socket}) ->
    {stop, closed, State};
  handle_info(_Info, State) ->
    {noreply, State}.
  
  
negative.code: 
  
  -spec handle_send(reference(), binary(), #state{}) ->
                     {reply, ok | {error, not_found}, #state{}} |
                     {stop, file:posix(), {error, file:posix()}, #state{}}.
  handle_send(Ref, Data, State) ->
    case lookup(Ref, State) of
      [{Ref, ReqId}] ->
        case send({fcgi_stdin, ReqId, Data}, State) of
          {ok, NewState} ->
            {reply, ok, NewState};
          Error = {error, Reason} ->
            {stop, Reason, Error, State} end;
      [] -> {reply, {error, not_found}, State} end.
  
  -spec send_packet_msg(ex_fcgi_protocol:packet(),
  