Bug 997690 - nsHttpConnection::IdleTimeout default can be set internally r=hurley

This commit is contained in:
Patrick McManus 2014-04-16 12:34:56 -04:00
parent c75a74a16f
commit 759b8bc24f
3 changed files with 6 additions and 10 deletions

View File

@ -48,7 +48,6 @@ nsHttpConnection::nsHttpConnection()
: mTransaction(nullptr)
, mHttpHandler(gHttpHandler)
, mCallbacksLock("nsHttpConnection::mCallbacksLock")
, mIdleTimeout(0)
, mConsiderReusedAfterInterval(0)
, mConsiderReusedAfterEpoch(0)
, mCurrentBytesRead(0)
@ -80,6 +79,12 @@ nsHttpConnection::nsHttpConnection()
, mTCPKeepaliveConfig(kTCPKeepaliveDisabled)
{
LOG(("Creating nsHttpConnection @%x\n", this));
// the default timeout is for when this connection has not yet processed a
// transaction
static const PRIntervalTime k5Sec = PR_SecondsToInterval(5);
mIdleTimeout =
(k5Sec < gHttpHandler->IdleTimeout()) ? k5Sec : gHttpHandler->IdleTimeout();
}
nsHttpConnection::~nsHttpConnection()

View File

@ -114,7 +114,6 @@ public:
bool IsPersistent() { return IsKeepAlive(); }
bool IsReused();
void SetIsReusedAfter(uint32_t afterMilliseconds);
void SetIdleTimeout(PRIntervalTime val) {mIdleTimeout = val;}
nsresult PushBack(const char *data, uint32_t length);
nsresult ResumeSend();
nsresult ResumeRecv();

View File

@ -3067,14 +3067,6 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
// this transaction was dispatched off the pending q before all the
// sockets established themselves.
// We need to establish a small non-zero idle timeout so the connection
// mgr perceives this socket as suitable for persistent connection reuse
const PRIntervalTime k5Sec = PR_SecondsToInterval(5);
if (k5Sec < gHttpHandler->IdleTimeout())
conn->SetIdleTimeout(k5Sec);
else
conn->SetIdleTimeout(gHttpHandler->IdleTimeout());
// After about 1 second allow for the possibility of restarting a
// transaction due to server close. Keep at sub 1 second as that is the
// minimum granularity we can expect a server to be timing out with.