diff options
author | Anders Svensson <[email protected]> | 2016-05-18 14:39:32 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2016-05-30 08:56:15 +0200 |
commit | 5ca5fb71695ccdf7267007b8405f7a13497a2f17 (patch) | |
tree | df6fb7c7a1fa9138da443e68c3df80bf789219ca /lib/diameter/src/compiler | |
parent | 7d7271121b4d2e786bf6fb41508166efb96e5842 (diff) | |
download | otp-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/compiler')
0 files changed, 0 insertions, 0 deletions