aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-06-20 14:28:49 +0200
committerSverker Eriksson <[email protected]>2012-06-20 17:06:07 +0200
commit4ce6c4d5618ae8cfb39f8c08fb1cf937fc9db09a (patch)
treea040054fb9e7b8ee6cc752b35a1b40b81a459575 /lib/kernel/src/inet.erl
parent644c6d246b0d08f74ccec1d6aa8e83f16678c403 (diff)
downloadotp-4ce6c4d5618ae8cfb39f8c08fb1cf937fc9db09a.tar.gz
otp-4ce6c4d5618ae8cfb39f8c08fb1cf937fc9db09a.tar.bz2
otp-4ce6c4d5618ae8cfb39f8c08fb1cf937fc9db09a.zip
Optimize inet:tcp_controlling_process
by removing unecessary inet:setops calls.
Diffstat (limited to 'lib/kernel/src/inet.erl')
-rw-r--r--lib/kernel/src/inet.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index a651e82122..41460c948b 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -1255,7 +1255,10 @@ tcp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) ->
_ ->
case prim_inet:getopt(S, active) of
{ok, A0} ->
- prim_inet:setopt(S, active, false),
+ case A0 of
+ false -> ok;
+ _ -> prim_inet:setopt(S, active, false)
+ end,
case tcp_sync_input(S, NewOwner, false) of
true -> %% socket already closed,
ok;
@@ -1263,7 +1266,10 @@ tcp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) ->
try erlang:port_connect(S, NewOwner) of
true ->
unlink(S), %% unlink from port
- prim_inet:setopt(S, active, A0),
+ case A0 of
+ false -> ok;
+ _ -> prim_inet:setopt(S, active, A0)
+ end,
ok
catch
error:Reason ->