From 288d2431d99bc9dc30c6c6e9564546399c29db60 Mon Sep 17 00:00:00 2001 From: Sean Cribbs Date: Wed, 6 Feb 2013 16:28:25 -0600 Subject: Fix type of error Reason on gen_tcp:send/2 When the TCP socket is in passive mode, it is possible that a close message has not been delivered to the controlling process before calling send/2. This results in the returning {error, closed} to the caller, in the same way that recv/2,3 does. This commit adjusts the type of the error "Reason" to include the atom 'closed'. --- lib/kernel/src/gen_tcp.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kernel') diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl index ec13ab6d2e..23867300a5 100644 --- a/lib/kernel/src/gen_tcp.erl +++ b/lib/kernel/src/gen_tcp.erl @@ -256,7 +256,7 @@ close(S) -> -spec send(Socket, Packet) -> ok | {error, Reason} when Socket :: socket(), Packet :: iodata(), - Reason :: inet:posix(). + Reason :: closed | inet:posix(). send(S, Packet) when is_port(S) -> case inet_db:lookup_socket(S) of -- cgit v1.2.3