diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2018-07-17 20:50:58 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2018-07-17 20:50:58 +0200 |
commit | 68c9328a9c9c74df79e66d008a1d25ff64cfd33f (patch) | |
tree | ad78006dfd881ff0b09a54a5132239c0fce01e66 /src/eldap.erl | |
parent | mod_http_upload: Add "Allow" to OPTIONS response (diff) |
Move cancel_timer/1 function into 'misc' module
Diffstat (limited to 'src/eldap.erl')
-rw-r--r-- | src/eldap.erl | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/eldap.erl b/src/eldap.erl index fc3b8a29..760f2557 100644 --- a/src/eldap.erl +++ b/src/eldap.erl @@ -659,7 +659,7 @@ handle_info({Tag, _Socket, Data}, connecting, S) {next_state, connecting, S}; handle_info({Tag, _Socket, Data}, wait_bind_response, S) when Tag == tcp; Tag == ssl -> - cancel_timer(S#eldap.bind_timer), + misc:cancel_timer(S#eldap.bind_timer), case catch recvd_wait_bind_response(Data, S) of bound -> dequeue_commands(S); {fail_bind, Reason} -> @@ -847,14 +847,14 @@ recvd_packet(Pkt, S) -> if Reason == success; Reason == sizeLimitExceeded -> {Res, Ref} = polish(Result_so_far), New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), {reply, #eldap_search_result{entries = Res, referrals = Ref}, From, S#eldap{dict = New_dict}}; true -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), {reply, {error, Reason}, From, S#eldap{dict = New_dict}} end; @@ -863,37 +863,37 @@ recvd_packet(Pkt, S) -> {ok, S#eldap{dict = New_dict}}; {addRequest, {addResponse, Result}} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), Reply = check_reply(Result, From), {reply, Reply, From, S#eldap{dict = New_dict}}; {delRequest, {delResponse, Result}} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), Reply = check_reply(Result, From), {reply, Reply, From, S#eldap{dict = New_dict}}; {modifyRequest, {modifyResponse, Result}} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), Reply = check_reply(Result, From), {reply, Reply, From, S#eldap{dict = New_dict}}; {modDNRequest, {modDNResponse, Result}} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), Reply = check_reply(Result, From), {reply, Reply, From, S#eldap{dict = New_dict}}; {bindRequest, {bindResponse, Result}} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), Reply = check_bind_reply(Result, From), {reply, Reply, From, S#eldap{dict = New_dict}}; {extendedReq, {extendedResp, Result}} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), Reply = check_extended_reply(Result, From), {reply, Reply, From, S#eldap{dict = New_dict}}; {OtherName, OtherResult} -> New_dict = dict:erase(Id, Dict), - cancel_timer(Timer), + misc:cancel_timer(Timer), {reply, {error, {invalid_result, OtherName, OtherResult}}, From, S#eldap{dict = New_dict}} @@ -968,16 +968,11 @@ check_id(_, _) -> throw({error, wrong_bind_id}). %% General Helpers %%----------------------------------------------------------------------- -cancel_timer(Timer) -> - erlang:cancel_timer(Timer), - receive {timeout, Timer, _} -> ok after 0 -> ok end. - - close_and_retry(S, Timeout) -> catch (S#eldap.sockmod):close(S#eldap.fd), Queue = dict:fold(fun (_Id, [{Timer, Command, From, _Name} | _], Q) -> - cancel_timer(Timer), + misc:cancel_timer(Timer), queue:in_r({Command, From}, Q); (_, _, Q) -> Q end, |