You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/12 07:21:11 UTC

[22/33] ibrowse commit: updated refs/heads/import-master to 1167b0e

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


Project: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/commit/a284c874
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/tree/a284c874
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/diff/a284c874

Branch: refs/heads/import-master
Commit: a284c874f0c72361dbe7362e8a15a67c969d80a0
Parents: db7f903
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Wed Nov 3 17:03:05 2010 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Wed Nov 3 17:03:05 2010 +0000

----------------------------------------------------------------------
 ibrowse_http_client.erl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/a284c874/ibrowse_http_client.erl
----------------------------------------------------------------------
diff --git a/ibrowse_http_client.erl b/ibrowse_http_client.erl
index 16d9b87..2dd209d 100644
--- a/ibrowse_http_client.erl
+++ b/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.