aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2016-06-08 09:56:04 +0200
committerRaimo Niskanen <[email protected]>2016-06-08 14:45:32 +0200
commitf429adba7e7a862b9949821b40aa3cba12455b3e (patch)
treeeab986313b34e0acb67caafae26f3e3e985b65e1 /lib/kernel/src/inet.erl
parent2c9dba638a8bda92e3db2d5c07e6ba251330c7ca (diff)
downloadotp-f429adba7e7a862b9949821b40aa3cba12455b3e.tar.gz
otp-f429adba7e7a862b9949821b40aa3cba12455b3e.tar.bz2
otp-f429adba7e7a862b9949821b40aa3cba12455b3e.zip
Remove internal state BOUND from inet_drv
Diffstat (limited to 'lib/kernel/src/inet.erl')
-rw-r--r--lib/kernel/src/inet.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index de43ea792b..a7b3c1cef4 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -1296,7 +1296,7 @@ gethostbyaddr_tm_native(Addr, Timer, Opts) ->
end.
-spec open(Fd_or_OpenOpts :: integer() | list(),
- Addr :: socket_address(),
+ Addr :: socket_address() | undefined,
Port :: port_number(),
Opts :: [socket_setopt()],
Protocol :: socket_protocol(),
@@ -1316,11 +1316,16 @@ open(FdO, Addr, Port, Opts, Protocol, Family, Type, Module)
{ok,S} ->
case prim_inet:setopts(S, Opts) of
ok ->
- case if is_list(Addr) ->
- bindx(S, Addr, Port);
- true ->
- prim_inet:bind(S, Addr, Port)
- end of
+ case
+ case Addr of
+ undefined ->
+ {ok, undefined};
+ _ when is_list(Addr) ->
+ bindx(S, Addr, Port);
+ _ ->
+ prim_inet:bind(S, Addr, Port)
+ end
+ of
{ok, _} ->
inet_db:register_socket(S, Module),
{ok,S};