diff --git a/netwerk/base/public/nsISocketTransport.idl b/netwerk/base/public/nsISocketTransport.idl index 54e451262724..3cd7471c807b 100644 --- a/netwerk/base/public/nsISocketTransport.idl +++ b/netwerk/base/public/nsISocketTransport.idl @@ -32,6 +32,14 @@ interface nsISocketTransport : nsISupports * needed by HTTP/1.1 */ attribute long bytesExpected; + attribute unsigned long reuseCount; + /** + * Checks if the socket is still alive + * + * @param seconds amount of time after which the socket is always deemed to be + * dead (no further checking is done in this case); seconds = 0 + * will cause it not to do timeout checking at all + */ boolean isAlive (in unsigned long seconds); }; diff --git a/netwerk/base/src/nsSocketTransport.cpp b/netwerk/base/src/nsSocketTransport.cpp index a121944d2a42..5da6be374f08 100644 --- a/netwerk/base/src/nsSocketTransport.cpp +++ b/netwerk/base/src/nsSocketTransport.cpp @@ -422,10 +422,16 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) PRBool isalive = PR_FALSE; if (NS_SUCCEEDED (IsAlive (0, &isalive)) && !isalive) { - CloseConnection (); + if (mSocketFD) + { + PR_Close (mSocketFD); + mSocketFD = nsnull; + } mCurrentState = eSocketState_WaitConnect; mLastReuseCount = mReuseCount; + fireStatus (mCurrentState); + continue; } } @@ -1294,7 +1300,7 @@ NS_IMETHODIMP nsSocketTransport::GetReuseConnection(PRBool *_retval) { if (_retval == NULL) - return NS_ERROR_FAILURE; + return NS_ERROR_NULL_POINTER; *_retval = !mCloseConnectionOnceDone; return NS_OK; @@ -1311,6 +1317,23 @@ nsSocketTransport::SetReuseConnection(PRBool aReuse) return NS_OK; } +NS_IMETHODIMP +nsSocketTransport::GetReuseCount (PRUint32 * count) +{ + if (count == NULL) + return NS_ERROR_NULL_POINTER; + + *count = mReuseCount; + return NS_OK; +} + +NS_IMETHODIMP +nsSocketTransport::SetReuseCount (PRUint32 count) +{ + mReuseCount = count; + return NS_OK; +} + NS_IMETHODIMP nsSocketTransport::GetBytesExpected (PRInt32 * bytes) {