diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2009-11-09 20:17:51 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2009-11-09 20:17:51 +0000 |
commit | 2e3d4ea2bdb8515772a198a863575ddbd32fd09c (patch) | |
tree | a22fa33c8b0d6ff9aa423f2b340eedec24ea94b4 | |
parent | a641d97c1b7cff839ee7fb0681fc84ef582b0a38 (diff) |
wait 5 minutes before assuming a connection is stale
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@834212 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/mochiweb/mochiweb_request.erl | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/mochiweb/mochiweb_request.erl b/src/mochiweb/mochiweb_request.erl index 64c4f58d..e8f0a67c 100644 --- a/src/mochiweb/mochiweb_request.erl +++ b/src/mochiweb/mochiweb_request.erl @@ -39,8 +39,8 @@ %% @type response(). A mochiweb_response parameterized module instance. %% @type ioheaders() = headers() | [{key(), value()}]. -% 10 second default idle timeout --define(IDLE_TIMEOUT, 10000). +% 5 minute default idle timeout +-define(IDLE_TIMEOUT, 300000). % Maximum recv_body() length of 1MB -define(MAX_RECV_BODY, (1024*1024)). @@ -451,14 +451,11 @@ stream_chunked_body(MaxChunkSize, Fun, FunState) -> stream_unchunked_body(0, _MaxChunkSize, Fun, FunState) -> Fun({0, <<>>}, FunState); -stream_unchunked_body(Length, MaxChunkSize, Fun, FunState) when Length > MaxChunkSize -> - Bin = recv(MaxChunkSize), - NewState = Fun({MaxChunkSize, Bin}, FunState), - stream_unchunked_body(Length - MaxChunkSize, MaxChunkSize, Fun, NewState); -stream_unchunked_body(Length, MaxChunkSize, Fun, FunState) -> - Bin = recv(Length), - NewState = Fun({Length, Bin}, FunState), - stream_unchunked_body(0, MaxChunkSize, Fun, NewState). +stream_unchunked_body(Length, _, Fun, FunState) when Length > 0 -> + Bin = recv(0), + BinSize = size(Bin), + NewState = Fun({BinSize, Bin}, FunState), + stream_unchunked_body(Length - BinSize, 0, Fun, NewState). %% @spec read_chunk_length() -> integer() |