diff options
author | Rickard Green <[email protected]> | 2013-11-25 15:34:27 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2013-11-26 14:09:05 +0100 |
commit | e16f564fe0d64017d5cfcf56255f0a6965a6a471 (patch) | |
tree | 329ea6d90ba1c3834f2682d5cf97afaaa2c2d171 /erts/preloaded | |
parent | dc9ff931423b57e64abde0f1de7133f334abb780 (diff) | |
download | otp-e16f564fe0d64017d5cfcf56255f0a6965a6a471.tar.gz otp-e16f564fe0d64017d5cfcf56255f0a6965a6a471.tar.bz2 otp-e16f564fe0d64017d5cfcf56255f0a6965a6a471.zip |
Fix prim_inet:close/1
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/prim_inet.beam | bin | 72644 -> 72316 bytes | |||
-rw-r--r-- | erts/preloaded/src/prim_inet.erl | 28 |
2 files changed, 2 insertions, 26 deletions
diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam Binary files differindex 3fd0b9e106..0bb10486ea 100644 --- a/erts/preloaded/ebin/prim_inet.beam +++ b/erts/preloaded/ebin/prim_inet.beam 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% |