summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-11-03 17:03:05 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-11-03 17:03:05 +0000
commita4d3c2c3d10f7d7d513d141637353039b4c58741 (patch)
tree904e160bd90ec28f703ad3fa779645efe96dde30 /src
parent9860f2f03660a6bf15c9e2ade80ab3dbac0bac0a (diff)
Fix ibrowse 2.0.x inactivity timeouts not getting cleared.
Patch submitted upstream: http://github.com/cmullaparthi/ibrowse/issues/#issue/17 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1030534 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/ibrowse/ibrowse_http_client.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ibrowse/ibrowse_http_client.erl b/src/ibrowse/ibrowse_http_client.erl
index 16d9b872..2dd209da 100644
--- a/src/ibrowse/ibrowse_http_client.erl
+++ b/src/ibrowse/ibrowse_http_client.erl
@@ -1713,7 +1713,15 @@ set_inac_timer(State) ->
set_inac_timer(State, get_inac_timeout(State)).
set_inac_timer(_State, Timeout) when is_integer(Timeout) ->
- erlang:send_after(Timeout, self(), timeout);
+ TimerRef = erlang:send_after(Timeout, self(), timeout),
+ case erlang:put(inac_timer, TimerRef) of
+ OldTimer when is_reference(OldTimer) ->
+ erlang:cancel_timer(OldTimer),
+ receive timeout -> ok after 0 -> ok end;
+ _ ->
+ ok
+ end,
+ TimerRef;
set_inac_timer(_, _) ->
undefined.