diff options
author | Loïc Hoguin <[email protected]> | 2013-04-02 18:59:01 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-04-02 18:59:01 +0200 |
commit | 18b546fb020eba9765ed30deff9e0de730e394d0 (patch) | |
tree | 05dca0302439f75f4fc403997c4299b7b3a3547f /test | |
parent | 405a487949ca74aa5d910e1f5d6c4573bcc229d6 (diff) | |
parent | a700368b2cb021bb1cd007697db4a3bae0099f2d (diff) | |
download | ranch-18b546fb020eba9765ed30deff9e0de730e394d0.tar.gz ranch-18b546fb020eba9765ed30deff9e0de730e394d0.tar.bz2 ranch-18b546fb020eba9765ed30deff9e0de730e394d0.zip |
Merge branch 'fix-server-racecon' of git://github.com/fishcakez/ranch
Diffstat (limited to 'test')
-rw-r--r-- | test/acceptor_SUITE.erl | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl index ca8c856..861ea33 100644 --- a/test/acceptor_SUITE.erl +++ b/test/acceptor_SUITE.erl @@ -49,6 +49,7 @@ -export([supervisor_clean_child_restart/1]). -export([supervisor_conns_alive/1]). -export([supervisor_server_recover_state/1]). +-export([supervisor_clean_conns_sup_restart/1]). %% ct. @@ -77,7 +78,8 @@ groups() -> supervisor_clean_restart, supervisor_clean_child_restart, supervisor_conns_alive, - supervisor_server_recover_state + supervisor_server_recover_state, + supervisor_clean_conns_sup_restart ]}]. init_per_suite(Config) -> @@ -499,6 +501,26 @@ supervisor_server_recover_state(_) -> _ = erlang:trace(all, false, [all]), ok = clean_traces(). +supervisor_clean_conns_sup_restart(_) -> + %% Verify that a conns_sup can not register with the same Name as an already + %% registered conns_sup that is still alive. Make sure this does not crash + %% the ranch_server. + Name = supervisor_clean_conns_sup_restart, + {ok, _} = ranch:start_listener(Name, + 1, ranch_tcp, [{port, 0}], echo_protocol, []), + Server = erlang:whereis(ranch_server), + ServerMonRef = erlang:monitor(process, Server), + %% Exit because Name already registered and is alive. + {'EXIT', _} = (catch ranch_server:set_connections_sup(Name, self())), + receive + {'DOWN', ServerMonRef, process, Server, _} -> + error(ranch_server_down) + after + 1000 -> + ok + end, + ranch:stop_listener(Name). + %% Utility functions. connect_loop(_, 0, _) -> |