summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2018-01-25 01:12:38 +0300
committerMichael Klishin <michael@clojurewerkz.org>2018-01-25 01:12:38 +0300
commit4a3ee3a336bc82f2e56ec5d2292c80458ccc2974 (patch)
tree0bfa400116731c6ad3519fe61816d2505a228050 /src
parent8ff28b08eab9756cc3d0ea943a5488fd00e10401 (diff)
parent8a602070022c414366ef1ecba1cc23481b6643bd (diff)
downloadrabbitmq-server-git-4a3ee3a336bc82f2e56ec5d2292c80458ccc2974.tar.gz
Merge branch 'rabbitmq-server-vhost-sup-sup-badarg'
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_vhost_sup_sup.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rabbit_vhost_sup_sup.erl b/src/rabbit_vhost_sup_sup.erl
index 19d7cf61b7..558648400a 100644
--- a/src/rabbit_vhost_sup_sup.erl
+++ b/src/rabbit_vhost_sup_sup.erl
@@ -183,7 +183,13 @@ start_vhost(VHost, Node) ->
start_vhost(VHost) ->
case rabbit_vhost:exists(VHost) of
false -> {error, {no_such_vhost, VHost}};
- true -> supervisor2:start_child(?MODULE, [VHost])
+ true ->
+ case whereis(?MODULE) of
+ Pid when is_pid(Pid) ->
+ supervisor2:start_child(?MODULE, [VHost]);
+ undefined ->
+ {error, rabbit_vhost_sup_sup_not_running}
+ end
end.
-spec is_vhost_alive(rabbit_types:vhost()) -> boolean().
@@ -221,9 +227,13 @@ save_vhost_process(VHost, VHostProcessPid) ->
-spec lookup_vhost_sup_record(rabbit_types:vhost()) -> #vhost_sup{} | not_found.
lookup_vhost_sup_record(VHost) ->
- case ets:lookup(?MODULE, VHost) of
- [] -> not_found;
- [#vhost_sup{} = VHostSup] -> VHostSup
+ case ets:info(?MODULE, name) of
+ ?MODULE ->
+ case ets:lookup(?MODULE, VHost) of
+ [] -> not_found;
+ [#vhost_sup{} = VHostSup] -> VHostSup
+ end;
+ undefined -> not_found
end.
-spec vhost_sup_pid(rabbit_types:vhost()) -> no_pid | {ok, pid()}.