I’ve got an app that connects to a number of tcp ports using :ranch_tcp.connect/3
I connect in passive mode and then switch to active once I get {:ok, socket}
.
When I get the socket I execute a Telemetry
message:
case :ranch_tcp.connect(...) do
{:ok, socket} ->
...
:telemetry.execute(
[:some, :key],
%{active: 1}
)
...
I call :telemetry.execute
in each of handle_info({:tcp_closed, _socket}, _state )
and handle_info({:tcp_error, _socket}, _state )
where I set the active
key to 0
.
One of the systems I connect to is a back-up system that is only used if we need a fail-over for some reason. Thus there is only very infrequently traffic from that ip/port. When such a fail-over occurred I did not get any messages form the back-up connection.
Telemetry had not executed an active: 0
message.
So my question is:
Is there a way that a tcp connection in Ranch/gen_tcp can become inactive without being caught by {tcp_error, _}
or {tcp_closed, _}
?