зеркало из https://github.com/mozilla/pjs.git
back in we go
This commit is contained in:
Родитель
ac7117c01b
Коммит
c6b552f83f
|
@ -125,6 +125,7 @@ nsSocketTransport::nsSocketTransport():
|
|||
mOnStartReadFired (PR_FALSE),
|
||||
mCancelStatus(NS_OK),
|
||||
mCloseConnectionOnceDone(PR_FALSE),
|
||||
mLookupComplete(PR_FALSE),
|
||||
mCurrentState(eSocketState_Created),
|
||||
mHostName(nsnull),
|
||||
mLoadAttributes(LOAD_NORMAL),
|
||||
|
@ -140,6 +141,7 @@ nsSocketTransport::nsSocketTransport():
|
|||
mReadOffset (0),
|
||||
mWriteOffset(0),
|
||||
mStatus (NS_OK),
|
||||
mSyncStatus(NS_OK),
|
||||
mSuspendCount(0),
|
||||
mWriteCount (0),
|
||||
mBytesExpected(-1),
|
||||
|
@ -364,14 +366,18 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
|
|||
if (mCurrentState == eSocketState_WaitConnect)
|
||||
mStatus = NS_ERROR_CONNECTION_REFUSED;
|
||||
else
|
||||
mStatus = NS_BINDING_FAILED;
|
||||
mSyncStatus = mStatus = NS_BINDING_FAILED;
|
||||
}
|
||||
|
||||
if (PR_POLL_HUP & aSelectFlags) {
|
||||
PR_LOG(gSocketLog, PR_LOG_ERROR,
|
||||
("Operation failed via PR_POLL_HUP. [%s:%d %x].\n",
|
||||
mHostName, mPort, this));
|
||||
if (mCurrentState == eSocketState_WaitConnect) {
|
||||
mStatus = NS_ERROR_CONNECTION_REFUSED;
|
||||
} else {
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
mCurrentState = eSocketState_Error;
|
||||
}
|
||||
|
||||
|
@ -603,7 +609,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
|
|||
break;
|
||||
|
||||
case eSocketState_Timeout:
|
||||
mStatus = NS_ERROR_NET_TIMEOUT;
|
||||
mSyncStatus = mStatus = NS_ERROR_NET_TIMEOUT;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1692,9 +1698,13 @@ nsSocketTransport::OnStopLookup(nsISupports *aContext,
|
|||
|
||||
// If the lookup failed, set the status...
|
||||
if (NS_FAILED(aStatus)) {
|
||||
mStatus = aStatus;
|
||||
mSyncStatus = mStatus = aStatus;
|
||||
}
|
||||
|
||||
mLookupComplete = PR_TRUE;
|
||||
nsresult rv = mon.Notify();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Start processing the transport again - if necessary...
|
||||
if (GetFlag(eSocketDNS_Wait)) {
|
||||
ClearFlag(eSocketDNS_Wait);
|
||||
|
@ -1967,7 +1977,11 @@ nsSocketTransport::OpenInputStream(nsIInputStream* *result)
|
|||
"rv = %x.\n",
|
||||
mHostName, mPort, this, rv));
|
||||
|
||||
return rv;
|
||||
if (!mLookupComplete) {
|
||||
rv = mon.Wait();
|
||||
if (NS_FAILED(rv)) return rv; // interrupted
|
||||
}
|
||||
return mSyncStatus;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2019,19 +2033,23 @@ nsSocketTransport::OpenOutputStream(nsIOutputStream* *result)
|
|||
|
||||
SetWriteType(eSocketWrite_Sync);
|
||||
}
|
||||
/*
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mOperation = eSocketOperation_ReadWrite;
|
||||
// Start the crank.
|
||||
rv = mService->AddToWorkQ(this);
|
||||
}
|
||||
*/
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("--- Leaving nsSocketTransport::OpenOutputStream() [%s:%d %x].\t"
|
||||
"rv = %x.\n",
|
||||
mHostName, mPort, this, rv));
|
||||
|
||||
return rv;
|
||||
if (!mLookupComplete) {
|
||||
rv = mon.Wait();
|
||||
if (NS_FAILED(rv)) return rv; // interrupted
|
||||
}
|
||||
return mSyncStatus;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -205,6 +205,7 @@ protected:
|
|||
|
||||
nsresult mCancelStatus;
|
||||
PRBool mCloseConnectionOnceDone;
|
||||
PRBool mLookupComplete;
|
||||
nsSocketState mCurrentState;
|
||||
nsCOMPtr<nsIRequest> mDNSRequest;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
|
@ -234,6 +235,7 @@ protected:
|
|||
PRUint32 mReadOffset;
|
||||
PRUint32 mWriteOffset;
|
||||
nsresult mStatus;
|
||||
nsresult mSyncStatus;
|
||||
PRInt32 mSuspendCount;
|
||||
PRInt32 mWriteCount;
|
||||
nsCOMPtr<nsISupports> mWriteContext;
|
||||
|
|
Загрузка…
Ссылка в новой задаче