aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/transport/diameter_sctp.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-05-18 17:02:08 +0200
committerAnders Svensson <[email protected]>2015-05-24 16:13:42 +0200
commitf99b944f5d6faf3e8c56c10e3e81668bb44160e0 (patch)
treea977c5d0ff204eb81ef7815134c7a14a1213acea /lib/diameter/src/transport/diameter_sctp.erl
parent694db07c1383cfed66339b219fcf92c7a40bcfa8 (diff)
downloadotp-f99b944f5d6faf3e8c56c10e3e81668bb44160e0.tar.gz
otp-f99b944f5d6faf3e8c56c10e3e81668bb44160e0.tar.bz2
otp-f99b944f5d6faf3e8c56c10e3e81668bb44160e0.zip
Fix diameter_sctp listener race
Commit 4b691d8d made it possible for accepting transport processes to be started concurrently, and commit 77c1b162 adapted diameter_sctp to this, but missed that the publication of the listener process in diameter_reg has to precede the return of its start function. As a result, concurrent starts could result in multiple listener processes.
Diffstat (limited to 'lib/diameter/src/transport/diameter_sctp.erl')
-rw-r--r--lib/diameter/src/transport/diameter_sctp.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl
index 2c8d6f0a14..f80de0a816 100644
--- a/lib/diameter/src/transport/diameter_sctp.erl
+++ b/lib/diameter/src/transport/diameter_sctp.erl
@@ -223,9 +223,9 @@ init(T) ->
i({listen, Ref, {Opts, Addrs}}) ->
{[Matches], Rest} = proplists:split(Opts, [accept]),
{LAs, Sock} = AS = open(Addrs, Rest, ?DEFAULT_PORT),
- proc_lib:init_ack({ok, self(), LAs}),
ok = gen_sctp:listen(Sock, true),
true = diameter_reg:add_new({?MODULE, listener, {Ref, AS}}),
+ proc_lib:init_ack({ok, self(), LAs}),
start_timer(#listener{ref = Ref,
socket = Sock,
accept = accept(Matches)});