aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2018-03-05 11:33:53 +0100
committerAnders Svensson <[email protected]>2018-03-05 11:33:53 +0100
commit5ac73d785185d857000f4ba72dc6fa5266ff80d1 (patch)
treecbc14d1755d42cbd96b60776b50a212cb510a06b /lib/diameter/src
parent9ed04ac83dc3bf68bc968e18a3dbd0fd73ea3ce6 (diff)
parentd73df2f7850184a8e1f44fdc82217935c25e867b (diff)
downloadotp-5ac73d785185d857000f4ba72dc6fa5266ff80d1.tar.gz
otp-5ac73d785185d857000f4ba72dc6fa5266ff80d1.tar.bz2
otp-5ac73d785185d857000f4ba72dc6fa5266ff80d1.zip
Merge branch 'anders/diameter/terminate/ERIERL-124' into maint
* anders/diameter/terminate/ERIERL-124: Fix handling of SUSPECT connections at service termination
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/base/diameter_service.erl20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index 31dd92f878..55ebcafcf9 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -554,15 +554,25 @@ terminate(Reason, #state{service_name = Name, local = {PeerT, _, _}} = S) ->
%% wait for watchdog state changes to take care of if. That this
%% takes place after deleting the state entry ensures that the
%% resulting failover by request processes accomplishes nothing.
- ets:foldl(fun(#peer{pid = TPid}, _) ->
- diameter_traffic:peer_down(TPid)
- end,
- ok,
- PeerT),
+ ets:foldl(fun peer_down/2, ok, PeerT),
shutdown == Reason %% application shutdown
andalso shutdown(application, S).
+%% peer_down/1
+%%
+%% Entries with watchdog state SUSPECT are already down: ignore the
+%% expected failure. This assumes the current implementation, but
+%% double the number of lookups (in the typical case) could be the
+%% greater evil if there are many peer connections.
+
+peer_down(#peer{pid = TPid}, _) ->
+ try
+ diameter_traffic:peer_down(TPid)
+ catch
+ error: {badmatch, []} -> ok
+ end.
+
%% ---------------------------------------------------------------------------
%% # code_change/3
%% ---------------------------------------------------------------------------