aboutsummaryrefslogtreecommitdiff
path: root/src/eldap
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2010-11-22 16:01:39 +0100
committerBadlop <badlop@process-one.net>2010-11-22 16:04:07 +0100
commit0a59ebe4050f3dd78f593aefcd4626015f395468 (patch)
treed8e66e9fe7341f24a1f562095346f47e42692a0f /src/eldap
parentRevert "populate pubsub#roster_groups_allowed in node configuration options (... (diff)
Use pg2 from R14B in systems with older versions (EJAB-1349)
pg2_backport.erl is a copy of pg2.erl from Erlang/OTP R14B. That module is used in ejabberd installations where an OTP previous to R14 is installed.
Diffstat (limited to 'src/eldap')
-rw-r--r--src/eldap/Makefile.in1
-rw-r--r--src/eldap/eldap_pool.erl12
2 files changed, 10 insertions, 3 deletions
diff --git a/src/eldap/Makefile.in b/src/eldap/Makefile.in
index 2ebbdaf73..158252670 100644
--- a/src/eldap/Makefile.in
+++ b/src/eldap/Makefile.in
@@ -11,6 +11,7 @@ ASN_FLAGS = -bber_bin +optimize +driver
ERLANG_CFLAGS = @ERLANG_CFLAGS@
ERLANG_LIBS = @ERLANG_LIBS@
+EFLAGS += @ERLANG_SSLVER@
EFLAGS += -I ..
EFLAGS += -pz ..
diff --git a/src/eldap/eldap_pool.erl b/src/eldap/eldap_pool.erl
index c8f224824..1b2961243 100644
--- a/src/eldap/eldap_pool.erl
+++ b/src/eldap/eldap_pool.erl
@@ -37,6 +37,12 @@
-include("ejabberd.hrl").
+-ifdef(SSL40).
+-define(PG2, pg2).
+-else.
+-define(PG2, pg2_backport).
+-endif.
+
%%====================================================================
%% API
%%====================================================================
@@ -51,14 +57,14 @@ modify_passwd(PoolName, DN, Passwd) ->
start_link(Name, Hosts, Backups, Port, Rootdn, Passwd, Opts) ->
PoolName = make_id(Name),
- pg2:create(PoolName),
+ ?PG2:create(PoolName),
lists:foreach(
fun(Host) ->
ID = erlang:ref_to_list(make_ref()),
case catch eldap:start_link(ID, [Host|Backups], Port,
Rootdn, Passwd, Opts) of
{ok, Pid} ->
- pg2:join(PoolName, Pid);
+ ?PG2:join(PoolName, Pid);
_ ->
error
end
@@ -68,7 +74,7 @@ start_link(Name, Hosts, Backups, Port, Rootdn, Passwd, Opts) ->
%% Internal functions
%%====================================================================
do_request(Name, {F, Args}) ->
- case pg2:get_closest_pid(make_id(Name)) of
+ case ?PG2:get_closest_pid(make_id(Name)) of
Pid when is_pid(Pid) ->
case catch apply(eldap, F, [Pid | Args]) of
{'EXIT', {timeout, _}} ->