couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1030534 - /couchdb/trunk/src/ibrowse/ibrowse_http_client.erl
Date Wed, 03 Nov 2010 17:03:06 GMT
Author: fdmanana
Date: Wed Nov  3 17:03:05 2010
New Revision: 1030534

URL: http://svn.apache.org/viewvc?rev=1030534&view=rev
Log:
Fix ibrowse 2.0.x inactivity timeouts not getting cleared.
Patch submitted upstream: http://github.com/cmullaparthi/ibrowse/issues/#issue/17


Modified:
    couchdb/trunk/src/ibrowse/ibrowse_http_client.erl

Modified: couchdb/trunk/src/ibrowse/ibrowse_http_client.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_http_client.erl?rev=1030534&r1=1030533&r2=1030534&view=diff
==============================================================================
--- couchdb/trunk/src/ibrowse/ibrowse_http_client.erl (original)
+++ couchdb/trunk/src/ibrowse/ibrowse_http_client.erl Wed Nov  3 17:03:05 2010
@@ -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.
 



Mime
View raw message