diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-11-03 17:04:38 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-11-03 17:04:38 +0000 |
commit | aa92e73811342ec1398dd77c92017520f9987715 (patch) | |
tree | 77665286d37c71e3fe8bb8ff7a4125dc948c7a61 | |
parent | e29a0ad2dbc9a4fbb1e76741c251693a8e44c7e9 (diff) |
Merged revision 1030534 from trunk:
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/branches/1.0.x@1030537 13f79535-47bb-0310-9956-ffa450edef68
-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. |