From 70526ab4e8b5a0d84c5cfd27557a481707420ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Thu, 20 Oct 2016 01:05:45 +0200 Subject: 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. --- lib/kernel/doc/src/gen_tcp.xml | 6 +++++- lib/kernel/doc/src/gen_udp.xml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/kernel/doc') diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 08454b9832..e97db20062 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -231,7 +231,11 @@ do_recv(Sock, Bs) -> Socket. The controlling process is the process that receives messages from the socket. If called by any other process than the current controlling process, - {error, not_owner} is returned.

+ {error, not_owner} is returned. If the process identified + by Pid is not an existing local pid, + {error, badarg} is returned. {error, badarg} may also + be returned in some cases when Socket is closed + during the execution of this function.

If the socket is set in active mode, this function will transfer any messages in the mailbox of the caller to the new controlling process. diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml index 3f88a0272d..f79566ef71 100644 --- a/lib/kernel/doc/src/gen_udp.xml +++ b/lib/kernel/doc/src/gen_udp.xml @@ -68,7 +68,11 @@ Socket. The controlling process is the process that receives messages from the socket. If called by any other process than the current controlling process, - {error, not_owner} is returned.

+ {error, not_owner} is returned. If the process identified + by Pid is not an existing local pid, + {error, badarg} is returned. {error, badarg} may also + be returned in some cases when Socket is closed + during the execution of this function.

-- cgit v1.2.3