anchor.diff:              -> S;
           _
               -> S#state{keep_alive_ref = reset_timer(TimeOut,Ref)}
  -    end
  -.
  -
  -reset_timer(Ref,TimeOut) ->
  -    if Ref =/= undefned ->
  -        timer:cancel(Ref);
  +    end.
  +
  +reset_timer({TRef,_},TimeOut) ->
  +    if TRef =/= undefned ->
  +        timer:cancel(TRef);
           true -> ok
       end,
       set_keep_alive_timer(TimeOut).
  
positive.code: handle_info(connect_timeout, S = #state{connect_state = connecting}) ->
      prevent_connection(S,timeout);
  
  handle_info({keep_alive_timeout,Ref}, S = #state{ keep_alive_ref = Ref}) ->
      abort_connection(S,timeout);
  
  handle_info(_Info, State) ->
  
negative.code:     Ref = set_keep_alive_timer(TimeOut),
      S#state {keep_alive_ref = Ref,keep_alive_timeout = TimeOut}.
  
  %% We use MatchRef to ensure we only receive current timeouts.
  %% Thus we avoid some weird behavior if we happen to receive old timeout messages
  %% that we have already canceled. Example:
  %%
  %% 1. We set the timeout to 5000 ms
  %% 2. At 4999 ms we receive a new packet
  %% 3. At 5000 ms the timeout message fires
  %% 4. At 5001 ms We receive the packet:
  %%         - RESET the timeout
  %%         -Send back an ACK
  %% 5. At 5002 ms we receive the OLD timeout
  %% 5. At 5003 ms we close the connection, even though we just acked a packet 1ms ago!
  set_keep_alive_timer(Timeout) ->
      MatchRef = make_ref(),
      TRef = timer:send_after(Timeout, {keep_alive_timeout,MatchRef}),
      {TRef,MatchRef}.
  
  reset_keep_alive(S = #state{keep_alive_ref = Ref,keep_alive_timeout = TimeOut}) ->
  
  