diff options
-rw-r--r-- | lib/ssh/src/ssh_connection_manager.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl index 2e62312423..6e2fe9da74 100644 --- a/lib/ssh/src/ssh_connection_manager.erl +++ b/lib/ssh/src/ssh_connection_manager.erl @@ -607,8 +607,15 @@ check_cache(State, Cache) -> case proplists:get_value(size, ets:info(Cache)) of 0 -> Opts = proplists:get_value(ssh_opts, State#state.opts), - TimerRef = erlang:send_after(proplists:get_value(idle_time, Opts), self(), {'EXIT', [], "Timeout"}), - State#state{idle_timer_ref=TimerRef}; + case proplists:get_value(idle_time, Opts) of + infinity -> + State; + undefined -> + State; + Time -> + TimerRef = erlang:send_after(Time, self(), {'EXIT', [], "Timeout"}), + State#state{idle_timer_ref=TimerRef} + end; _ -> State end. |