aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorPéter Gömöri <[email protected]>2016-10-20 01:05:45 +0200
committerPéter Gömöri <[email protected]>2016-10-27 22:15:12 +0200
commit70526ab4e8b5a0d84c5cfd27557a481707420ce2 (patch)
treed6109885224a53f7400defddbbd5f39385adf0fc /lib/kernel/src
parent9be10412e1837aac339a284f2b01cfc112778180 (diff)
downloadotp-70526ab4e8b5a0d84c5cfd27557a481707420ce2.tar.gz
otp-70526ab4e8b5a0d84c5cfd27557a481707420ce2.tar.bz2
otp-70526ab4e8b5a0d84c5cfd27557a481707420ce2.zip
controlling_process can return {error, badarg}
For gen_tcp, gen_udp and gen_sctp controlling_process/2 can return badarg if erlang:port_connect/2 fails with badarg. This can easily happen if the new owner is not alive but in some race condition also when the socket is closed right before port_connect/2 (and after the previous socket function) This commit documents this behaviour.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/gen_sctp.erl2
-rw-r--r--lib/kernel/src/gen_tcp.erl2
-rw-r--r--lib/kernel/src/gen_udp.erl2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/kernel/src/gen_sctp.erl b/lib/kernel/src/gen_sctp.erl
index b133e6fed4..a6aa0edd15 100644
--- a/lib/kernel/src/gen_sctp.erl
+++ b/lib/kernel/src/gen_sctp.erl
@@ -439,7 +439,7 @@ error_string(X) ->
-spec controlling_process(Socket, Pid) -> ok | {error, Reason} when
Socket :: sctp_socket(),
Pid :: pid(),
- Reason :: closed | not_owner | inet:posix().
+ Reason :: closed | not_owner | badarg | inet:posix().
controlling_process(S, Pid) when is_port(S), is_pid(Pid) ->
inet:udp_controlling_process(S, Pid);
diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl
index 1a21541b7c..ac61dbc792 100644
--- a/lib/kernel/src/gen_tcp.erl
+++ b/lib/kernel/src/gen_tcp.erl
@@ -320,7 +320,7 @@ unrecv(S, Data) when is_port(S) ->
-spec controlling_process(Socket, Pid) -> ok | {error, Reason} when
Socket :: socket(),
Pid :: pid(),
- Reason :: closed | not_owner | inet:posix().
+ Reason :: closed | not_owner | badarg | inet:posix().
controlling_process(S, NewOwner) ->
case inet_db:lookup_socket(S) of
diff --git a/lib/kernel/src/gen_udp.erl b/lib/kernel/src/gen_udp.erl
index 98d2f0bcfb..3121544719 100644
--- a/lib/kernel/src/gen_udp.erl
+++ b/lib/kernel/src/gen_udp.erl
@@ -195,7 +195,7 @@ connect(S, Address, Port) when is_port(S) ->
-spec controlling_process(Socket, Pid) -> ok | {error, Reason} when
Socket :: socket(),
Pid :: pid(),
- Reason :: closed | not_owner | inet:posix().
+ Reason :: closed | not_owner | badarg | inet:posix().
controlling_process(S, NewOwner) ->
inet:udp_controlling_process(S, NewOwner).