From f17f232694d714ea9117ed0a69042657131f9644 Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Tue, 6 May 2014 11:14:51 +0100 Subject: [PATCH] Start xmerl if needed. --- src/amqp_connection.erl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/amqp_connection.erl b/src/amqp_connection.erl index b0dd1680..d6d044fb 100644 --- a/src/amqp_connection.erl +++ b/src/amqp_connection.erl @@ -168,15 +168,16 @@ start(AmqpParams) -> %% application controller is in the process of shutting down the very %% application which is making this call. ensure_started() -> - case application_controller:get_master(amqp_client) of - undefined -> - case amqp_client:start() of - ok -> ok; - {error, {already_started, amqp_client}} -> ok; - {error, _} = E -> throw(E) - end; - _ -> - ok + [ensure_started(App) || App <- [xmerl, amqp_client]]. + +ensure_started(App) -> + case application_controller:get_master(App) of + undefined -> case application:start(App) of + ok -> ok; + {error, {already_started, App}} -> ok; + {error, _} = E -> throw(E) + end; + _ -> ok end. %%---------------------------------------------------------------------------