diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-11-03 17:03:05 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-11-03 17:03:05 +0000 |
commit | a4d3c2c3d10f7d7d513d141637353039b4c58741 (patch) | |
tree | 904e160bd90ec28f703ad3fa779645efe96dde30 /src/ibrowse | |
parent | 9860f2f03660a6bf15c9e2ade80ab3dbac0bac0a (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/ibrowse')
-rw-r--r-- | src/ibrowse/ibrowse_http_client.erl | 10 |
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. |