anchor.diff:      end;
       
   handle_sync_event({recv, N, Timeout}, RecvFrom, connection = StateName, State0) ->
  -    start_or_recv_cancel_timer(Timeout, RecvFrom),
  -    passive_receive(State0#state{bytes_to_read = N, start_or_recv_from = RecvFrom}, StateName);
  +    Timer = start_or_recv_cancel_timer(Timeout, RecvFrom),
  +    passive_receive(State0#state{bytes_to_read = N,
  +				 start_or_recv_from = RecvFrom, timer = Timer}, StateName);
   
   %% Doing renegotiate wait with handling request until renegotiate is
   %% finished. Will be handled by next_state_is_connection/2.
   handle_sync_event({recv, N, Timeout}, RecvFrom, StateName, State) ->
  -    start_or_recv_cancel_timer(Timeout, RecvFrom),
  -    {next_state, StateName, State#state{bytes_to_read = N, start_or_recv_from = RecvFrom},
  +    Timer = start_or_recv_cancel_timer(Timeout, RecvFrom),
  +    {next_state, StateName, State#state{bytes_to_read = N, start_or_recv_from = RecvFrom,
  +					timer = Timer},
        get_timeout(State)};
   
   handle_sync_event({new_user, User}, _From, StateName, 
  
positive.code:     gen_fsm:reply(From, ok),
      State#state{renegotiation = undefined};
  ack_connection(#state{renegotiation = {false, first}, 
  		      start_or_recv_from = StartFrom} = State) when StartFrom =/= undefined ->
      gen_fsm:reply(StartFrom, connected),
      State#state{renegotiation = undefined, start_or_recv_from = undefined};
  ack_connection(State) ->
      State.
  
  
negative.code:     {stop, {shutdown, Error}, {error, Error}, State};
  
  handle_sync_event({start, Timeout}, StartFrom, StateName, State) ->
      Timer = start_or_recv_cancel_timer(Timeout, StartFrom),
      {next_state, StateName, State#state{start_or_recv_from = StartFrom,
  					timer = Timer}, get_timeout(State)};
  
  handle_sync_event(close, _, StateName, State) ->
      %% Run terminate before returning
  