From 36fc43c3647f5987a0591879126eb5a3c03be57e Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 3 Mar 2009 19:39:36 +0000 Subject: [PATCH] Merge 1883 from trunk. * src/ejabberd_listener.erl: More error detections SVN Revision: 1951 --- ChangeLog | 2 ++ src/ejabberd_listener.erl | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index aa94ff25d..0a23343da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2009-03-03 Badlop + * src/ejabberd_listener.erl: More error detections + * src/ejabberd_config.erl: Check certfiles are readable on server start and listener start (EJAB-753) * src/ejabberd_listener.erl: Likewise diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index df3e343d8..56df6d4cd 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -124,6 +124,7 @@ init(PortIP, Module, Opts1) -> {error, Reason} -> ReasonT = case Reason of eaddrnotavail -> "IP address not available: " ++ IPS; + eaddrinuse -> "IP address and port number already used: "++IPS++" "++integer_to_list(Port); _ -> atom_to_list(Reason) end, ?ERROR_MSG("Failed to open socket:~n ~p~nReason: ~s", @@ -225,6 +226,12 @@ start_listener(Port, Module, Opts) -> "It could not be loaded or is not an ejabberd listener.~n" "Error: ~p~n", [Module, Error]), {error, lists:flatten(EStr)}; + {error, {already_started, _Pid} = Error} -> + EStr = io_lib:format( + "Error starting the ejabberd listener: ~p.~n" + "A listener is already started in that port number and IP address:~n~p~n" + "Error: ~p~n", [Module, Port, Error]), + {error, lists:flatten(EStr)}; {error, Error} -> {error, Error} end.