Add reuseCount attribute on nsSocketTransport. Misc code cleanup.

This commit is contained in:
ruslan%netscape.com 2000-03-21 01:29:49 +00:00
Родитель 225179ca1e
Коммит 32c1eabc0e
2 изменённых файлов: 33 добавлений и 2 удалений

Просмотреть файл

@ -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);
};

Просмотреть файл

@ -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)
{