aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet_sctp.erl
diff options
context:
space:
mode:
authorHolger Weiß <[email protected]>2015-04-09 21:24:32 +0200
committerHolger Weiß <[email protected]>2015-04-09 21:24:32 +0200
commitc1780b76cdfefbb52025afcf27f6eab01a464e90 (patch)
tree141d5c19cbd9250fcf6ab432b51ff8cb2f53e87c /lib/kernel/src/inet_sctp.erl
parent545890576542e4be630df8772654b99bd0306f62 (diff)
downloadotp-c1780b76cdfefbb52025afcf27f6eab01a464e90.tar.gz
otp-c1780b76cdfefbb52025afcf27f6eab01a464e90.tar.bz2
otp-c1780b76cdfefbb52025afcf27f6eab01a464e90.zip
Don't throw exception on prim_inet:setopt/3 error
Let gen_tcp:controlling_process/2 and inet_sctp:connect/[45] propagate prim_inet:setopt/3 errors instead of having them generate badmatch exceptions.
Diffstat (limited to 'lib/kernel/src/inet_sctp.erl')
-rw-r--r--lib/kernel/src/inet_sctp.erl19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/kernel/src/inet_sctp.erl b/lib/kernel/src/inet_sctp.erl
index 93528d305d..f0f13c8d4a 100644
--- a/lib/kernel/src/inet_sctp.erl
+++ b/lib/kernel/src/inet_sctp.erl
@@ -133,15 +133,18 @@ connect_get_assoc(S, Addr, Port, Active, Timer) ->
Timeout = inet:timeout(Timer),
receive
{sctp,S,Addr,Port,{_,#sctp_assoc_change{state=St}=Ev}} ->
- case Active of
- once ->
- ok = prim_inet:setopt(S, active, once);
- _ -> ok
- end,
- if St =:= comm_up ->
+ SetOptRes =
+ case Active of
+ once -> prim_inet:setopt(S, active, once);
+ _ -> ok
+ end,
+ case {St, SetOptRes} of
+ {comm_up, ok} ->
{ok,Ev};
- true ->
- {error,Ev}
+ {_, ok} ->
+ {error,Ev};
+ {_, Error} ->
+ Error
end
after Timeout ->
{error,timeout}