mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 01:55:44 +00:00
Fixes 68483 as well as fixes some mem leaks cause by canceling a request. r=darin@netscape.com, sr=waterson@netscape.com
This commit is contained in:
parent
410f50c44e
commit
2c3940a081
@ -941,7 +941,10 @@ nsSocketTransport::doReadWrite(PRInt16 aSelectFlags)
|
||||
if (mReadRequest->IsCanceled() || (mBytesExpected == 0)) {
|
||||
LOG(("nsSocketTransport: [this=%x] completing read request due to cancelation\n", this));
|
||||
mSelectFlags &= ~PR_POLL_READ;
|
||||
mReadRequest->GetStatus(&readStatus);
|
||||
CompleteAsyncRead();
|
||||
if (NS_FAILED(readStatus))
|
||||
return readStatus;
|
||||
}
|
||||
else if (mSelectFlags & PR_POLL_READ) {
|
||||
//
|
||||
@ -976,7 +979,10 @@ nsSocketTransport::doReadWrite(PRInt16 aSelectFlags)
|
||||
if (mWriteRequest->IsCanceled()) {
|
||||
LOG(("nsSocketTransport: [this=%x] completing write request due to cancelation\n", this));
|
||||
mSelectFlags &= ~PR_POLL_WRITE;
|
||||
mWriteRequest->GetStatus(&writeStatus);
|
||||
CompleteAsyncWrite();
|
||||
if (NS_FAILED(writeStatus))
|
||||
return writeStatus;
|
||||
}
|
||||
else if (mSelectFlags & PR_POLL_WRITE) {
|
||||
//
|
||||
@ -1544,6 +1550,9 @@ nsSocketTransport::IsAlive (PRUint32 seconds, PRBool *alive)
|
||||
{
|
||||
*alive = PR_TRUE;
|
||||
|
||||
// Enter the socket transport lock...
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
|
||||
if (mSocketFD) {
|
||||
if (mLastActiveTime != PR_INTERVAL_NO_WAIT) {
|
||||
PRUint32 now = PR_IntervalToSeconds (PR_IntervalNow ());
|
||||
@ -2197,7 +2206,10 @@ nsSocketRequest::Cancel(nsresult status)
|
||||
LOG(("nsSocketRequest: Cancel [this=%x status=%x]\n", this, status));
|
||||
mStatus = status;
|
||||
mCanceled = PR_TRUE;
|
||||
// Will be canceled the next time PR_Poll returns
|
||||
|
||||
// if status is a fail, we need to force a dispatch
|
||||
if (NS_FAILED(status))
|
||||
mTransport->Dispatch(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,16 @@ HTTP_ATOM(Head, "HEAD")
|
||||
HTTP_ATOM(Post, "POST")
|
||||
HTTP_ATOM(Put, "PUT")
|
||||
HTTP_ATOM(Get, "GET")
|
||||
HTTP_ATOM(Index, "INDEX")
|
||||
HTTP_ATOM(Delete, "DELETE")
|
||||
HTTP_ATOM(Trace, "TRACE")
|
||||
HTTP_ATOM(Connect, "CONNECT")
|
||||
HTTP_ATOM(M_Post, "M-POST")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1056,6 +1056,8 @@ nsHTTPPipelinedRequest::Cancel(nsresult status)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(NS_FAILED(status), "Can't cancel with a sucessful status");
|
||||
|
||||
if (mCurrentReadRequest)
|
||||
rv = mCurrentReadRequest->Cancel(status);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user