aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_sup.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2016-05-18 14:39:32 +0200
committerAnders Svensson <[email protected]>2016-05-30 08:56:15 +0200
commit5ca5fb71695ccdf7267007b8405f7a13497a2f17 (patch)
treedf6fb7c7a1fa9138da443e68c3df80bf789219ca /lib/diameter/src/base/diameter_sup.erl
parent7d7271121b4d2e786bf6fb41508166efb96e5842 (diff)
downloadotp-5ca5fb71695ccdf7267007b8405f7a13497a2f17.tar.gz
otp-5ca5fb71695ccdf7267007b8405f7a13497a2f17.tar.bz2
otp-5ca5fb71695ccdf7267007b8405f7a13497a2f17.zip
Close listening sockets at transport removal
The transport interface documented in diameter_transport(3) is used to start/stop accepting/connecting transport processes: they're started with a function call, and told to die with their parent process. In the accepting case, both diameter_tcp and diameter_sctp start a listening process when the first accepting transport is started. However, there's no way for a listening process to find out that that it should stop listening when transport configuration is removed. Both diameter_tcp and diameter_sctp have used a timer to terminate the listening process after all existing accepting processes have died as a consequence of transport removal. The problem with this is that nothing stops a new client from connecting before this, and also that no new transport can succeed in opening the same listening port (eg. reconfiguration) until the old listener dies. This commit solves the problem by adding diameter_reg:subscribe/2, to allow callers to subscribe to messages about added/removed associations. A call to diameter:add_transport/2 results in a new child process that registers a term that a listening process subscribes to. Transport removal results in the death of the child, and the resulting notification to the listener causes the latter to close its socket and terminate. This is still an internal interface, but the subscription mechanism should probably be made external (eg. a diameter:subscribe/1 that can be used to subscribe to specified messages), so that transport modules other than diameter's own can make use of it. There is no support for soft upgrade.
Diffstat (limited to 'lib/diameter/src/base/diameter_sup.erl')
-rw-r--r--lib/diameter/src/base/diameter_sup.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/diameter/src/base/diameter_sup.erl b/lib/diameter/src/base/diameter_sup.erl
index e89ede9843..482289cb9a 100644
--- a/lib/diameter/src/base/diameter_sup.erl
+++ b/lib/diameter/src/base/diameter_sup.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
-export([init/1]).
-define(CHILDREN, [diameter_misc_sup,
+ diameter_config_sup,
diameter_watchdog_sup,
diameter_peer_fsm_sup,
diameter_transport_sup,