diff options
author | Anders Svensson <[email protected]> | 2015-06-19 01:26:06 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2015-06-19 03:03:14 +0200 |
commit | 1d3827223b0c4174ab39fa6af3e969e4a62f598f (patch) | |
tree | 2aa6bc31f972ef84a7da09f4ff8843524174cd36 /lib/diameter/src/transport/diameter_sctp.erl | |
parent | 083ae6d719a8ab5d626ad4b28e836475b6c1a92b (diff) | |
download | otp-1d3827223b0c4174ab39fa6af3e969e4a62f598f.tar.gz otp-1d3827223b0c4174ab39fa6af3e969e4a62f598f.tar.bz2 otp-1d3827223b0c4174ab39fa6af3e969e4a62f598f.zip |
Don't monitor listener after peeloff
Listener death should have no effect on a peeled off association.
Diffstat (limited to 'lib/diameter/src/transport/diameter_sctp.erl')
-rw-r--r-- | lib/diameter/src/transport/diameter_sctp.erl | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl index 29ac73a6a6..51b4858ab0 100644 --- a/lib/diameter/src/transport/diameter_sctp.erl +++ b/lib/diameter/src/transport/diameter_sctp.erl @@ -246,19 +246,19 @@ i({accept, Pid, LPid, LSock, Ref}) putr(?REF_KEY, Ref), proc_lib:init_ack({ok, self()}), monitor(process, Pid), - monitor(process, LPid), - wait([peeloff], #transport{parent = Pid, - mode = {accept, LPid}, - socket = LSock}); + MRef = monitor(process, LPid), + wait([{peeloff, MRef}], #transport{parent = Pid, + mode = {accept, LPid}, + socket = LSock}); %% An accepting transport spawned at association establishment. i({accept, Ref, LPid, LSock, _Id}) -> putr(?REF_KEY, Ref), proc_lib:init_ack({ok, self()}), erlang:send_after(?ACCEPT_TIMEOUT, self(), accept_timeout), - monitor(process, LPid), - wait([Ref, peeloff], #transport{mode = {accept, LPid}, - socket = LSock}). + MRef = monitor(process, LPid), + wait([{parent, Ref}, {peeloff, MRef}], #transport{mode = {accept, LPid}, + socket = LSock}). %% wait/2 %% @@ -268,15 +268,16 @@ i({accept, Ref, LPid, LSock, _Id}) -> wait(Keys, S) -> lists:foldl(fun i/2, S, Keys). -i(K, #transport{mode = {accept, _}, - socket = LSock} - = S) -> +i({K, Ref}, #transport{mode = {accept, _}, + socket = LSock} + = S) -> receive - {K, Pid} when is_reference(K) -> %% transport process started + {Ref, Pid} when K == parent -> %% transport process started S#transport{parent = Pid}; {K, Sock, T, Matches} when K == peeloff -> %% association {sctp, LSock, _RA, _RP, _Data} = T, %% assert ok = accept_peer(Sock, Matches), + demonitor(Ref, [flush]), t(setelement(2, T, Sock), S#transport{socket = Sock}); accept_timeout = T -> x(T); @@ -575,15 +576,6 @@ transition({diameter, {tls, _Ref, _Type, _Bool}}, _) -> transition({'DOWN', _, process, Pid, _}, #transport{parent = Pid}) -> stop; -%% Listener process has died. -transition({'DOWN', _, process, Pid, _}, #transport{mode = {accept, Pid}}) -> - stop; - -%% Ditto but we have ownership of the association. It might be that -%% we'll go down anyway though. -transition({'DOWN', _, process, _Pid, _}, #transport{mode = accept}) -> - ok; - %% Timeout after transport process has been started. transition(accept_timeout, _) -> ok; |