Skip to content

Commit

Permalink
BEARS-180: Capture all possible tcp closed reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
mfos239 committed Apr 27, 2023
1 parent fecf4b6 commit 20272ec
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/mllp/tcp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ defmodule MLLP.TCP do
"""
@spec is_closed?(socket :: :gen_tcp.socket()) :: boolean()
def is_closed?(socket) do
case recv(socket, _length = 0, _timeout = 1) do
{:error, :closed} -> true
{:error, :enotconn} -> true
case recv(socket, _length = 0, _timeout = 1000) do
{:error, _reason} -> true
_ -> false
end
end
Expand Down

0 comments on commit 20272ec

Please sign in to comment.