aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/prim_inet.erl
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2013-11-25 15:34:27 +0100
committerRickard Green <[email protected]>2013-11-26 14:09:05 +0100
commite16f564fe0d64017d5cfcf56255f0a6965a6a471 (patch)
tree329ea6d90ba1c3834f2682d5cf97afaaa2c2d171 /erts/preloaded/src/prim_inet.erl
parentdc9ff931423b57e64abde0f1de7133f334abb780 (diff)
downloadotp-e16f564fe0d64017d5cfcf56255f0a6965a6a471.tar.gz
otp-e16f564fe0d64017d5cfcf56255f0a6965a6a471.tar.bz2
otp-e16f564fe0d64017d5cfcf56255f0a6965a6a471.zip
Fix prim_inet:close/1
Diffstat (limited to 'erts/preloaded/src/prim_inet.erl')
-rw-r--r--erts/preloaded/src/prim_inet.erl28
1 files changed, 2 insertions, 26 deletions
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl
index aa700c5194..a9df75327c 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -186,32 +186,8 @@ close_pend_loop(S, N) ->
end.
close_port(S) ->
- case erlang:process_info(self(), trap_exit) of
- {trap_exit,true} ->
- %% Ensure exit message and consume it
- link(S),
- %% This is still not a perfect solution.
- %%
- %% The problem is to close the port and consume any exit
- %% message while not knowing if this process traps exit
- %% nor if this process has a link to the port. Here we
- %% just knows that this process traps exit.
- %%
- %% If we right here get killed for some reason that exit
- %% signal will propagate to the port and onwards to anyone
- %% that is linked to the port. E.g when we close a socket
- %% that is not ours.
- %%
- %% The problem can be solved with lists:member on our link
- %% list but we deem that as potentially too expensive. We
- %% need an is_linked/1 function or guard, or we need
- %% a port_close function that can atomically unlink...
- catch erlang:port_close(S),
- receive {'EXIT',S,_} -> ok end;
- {trap_exit,false} ->
- catch erlang:port_close(S),
- ok
- end.
+ catch erlang:port_close(S),
+ receive {'EXIT',S,_} -> ok after 0 -> ok end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%