mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Merge 1856 from trunk.
* src/eldap/eldap.erl: moves waiting for response queries to pending queue on an LDAP connection failure (thanks to Evgeniy Khramtsov) SVN Revision: 1974
This commit is contained in:
parent
d23ebd354b
commit
cf4b7b36ee
@ -1,5 +1,9 @@
|
|||||||
2009-03-06 Badlop <badlop@process-one.net>
|
2009-03-06 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/eldap/eldap.erl: moves waiting for response queries to
|
||||||
|
pending queue on an LDAP connection failure (thanks to Evgeniy
|
||||||
|
Khramtsov)
|
||||||
|
|
||||||
* src/eldap/eldap.erl: implemented queue for pending
|
* src/eldap/eldap.erl: implemented queue for pending
|
||||||
queries (thanks to Evgeniy Khramtsov)
|
queries (thanks to Evgeniy Khramtsov)
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ send_command(Command, From, S) ->
|
|||||||
case gen_tcp:send(S#eldap.fd, Bytes) of
|
case gen_tcp:send(S#eldap.fd, Bytes) of
|
||||||
ok ->
|
ok ->
|
||||||
Timer = erlang:start_timer(?CMD_TIMEOUT, self(), {cmd_timeout, Id}),
|
Timer = erlang:start_timer(?CMD_TIMEOUT, self(), {cmd_timeout, Id}),
|
||||||
New_dict = dict:store(Id, [{Timer, From, Name}], S#eldap.dict),
|
New_dict = dict:store(Id, [{Timer, Command, From, Name}], S#eldap.dict),
|
||||||
{ok, S#eldap{id = Id, dict = New_dict}};
|
{ok, S#eldap{id = Id, dict = New_dict}};
|
||||||
Error ->
|
Error ->
|
||||||
Error
|
Error
|
||||||
@ -730,7 +730,7 @@ check_bind_reply(Other, _From) ->
|
|||||||
|
|
||||||
get_op_rec(Id, Dict) ->
|
get_op_rec(Id, Dict) ->
|
||||||
case dict:find(Id, Dict) of
|
case dict:find(Id, Dict) of
|
||||||
{ok, [{Timer, From, Name}|Res]} ->
|
{ok, [{Timer, _Command, From, Name}|Res]} ->
|
||||||
{Timer, From, Name, Res};
|
{Timer, From, Name, Res};
|
||||||
error ->
|
error ->
|
||||||
throw({error, unkown_id})
|
throw({error, unkown_id})
|
||||||
@ -792,8 +792,15 @@ check_tag(Data) ->
|
|||||||
|
|
||||||
close_and_retry(S) ->
|
close_and_retry(S) ->
|
||||||
catch gen_tcp:close(S#eldap.fd),
|
catch gen_tcp:close(S#eldap.fd),
|
||||||
|
Queue = dict:fold(
|
||||||
|
fun(_Id, [{Timer, Command, From, _Name}|_], Q) ->
|
||||||
|
cancel_timer(Timer),
|
||||||
|
queue:in_r({Command, From}, Q);
|
||||||
|
(_, _, Q) ->
|
||||||
|
Q
|
||||||
|
end, S#eldap.req_q, S#eldap.dict),
|
||||||
erlang:send_after(?RETRY_TIMEOUT, self(), {timeout, retry_connect}),
|
erlang:send_after(?RETRY_TIMEOUT, self(), {timeout, retry_connect}),
|
||||||
S#eldap{fd = null}.
|
S#eldap{fd=null, req_q=Queue, dict=dict:new()}.
|
||||||
|
|
||||||
%%-----------------------------------------------------------------------
|
%%-----------------------------------------------------------------------
|
||||||
%% Sort out timed out commands
|
%% Sort out timed out commands
|
||||||
@ -801,7 +808,7 @@ close_and_retry(S) ->
|
|||||||
cmd_timeout(Timer, Id, S) ->
|
cmd_timeout(Timer, Id, S) ->
|
||||||
Dict = S#eldap.dict,
|
Dict = S#eldap.dict,
|
||||||
case dict:find(Id, Dict) of
|
case dict:find(Id, Dict) of
|
||||||
{ok, [{Timer, From, Name}|Res]} ->
|
{ok, [{Timer, _Command, From, Name}|Res]} ->
|
||||||
case Name of
|
case Name of
|
||||||
searchRequest ->
|
searchRequest ->
|
||||||
{Res1, Ref1} = polish(Res),
|
{Res1, Ref1} = polish(Res),
|
||||||
|
Loading…
Reference in New Issue
Block a user