зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a4247f89d070 (bug 1520483
) for bustage on build/src/obj-firefox/dist/include/mozilla/Logging.h:257. CLOSED TREE
This commit is contained in:
Родитель
4dc6785da8
Коммит
026d525390
|
@ -47,7 +47,7 @@ TLSFilterTransaction::TLSFilterTransaction(nsAHttpTransaction *aWrapped,
|
|||
mSegmentWriter(aWriter),
|
||||
mFilterReadCode(NS_ERROR_NOT_INITIALIZED),
|
||||
mForce(false),
|
||||
mReadSegmentReturnValue(NS_OK),
|
||||
mReadSegmentBlocked(false),
|
||||
mNudgeCounter(0) {
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
LOG(("TLSFilterTransaction ctor %p\n", this));
|
||||
|
@ -149,7 +149,7 @@ nsresult TLSFilterTransaction::OnReadSegment(const char *aData, uint32_t aCount,
|
|||
LOG(("TLSFilterTransaction %p OnReadSegment %d (buffered %d)\n", this, aCount,
|
||||
mEncryptedTextUsed));
|
||||
|
||||
mReadSegmentReturnValue = NS_OK;
|
||||
mReadSegmentBlocked = false;
|
||||
MOZ_ASSERT(mSegmentReader);
|
||||
if (!mSecInfo) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -196,12 +196,17 @@ nsresult TLSFilterTransaction::OnReadSegment(const char *aData, uint32_t aCount,
|
|||
return NS_OK;
|
||||
}
|
||||
// mTransaction ReadSegments actually obscures this code, so
|
||||
// keep it in a member var for this::ReadSegments to inspect. Similar
|
||||
// keep it in a member var for this::ReadSegments to insepct. Similar
|
||||
// to nsHttpConnection::mSocketOutCondition
|
||||
PRErrorCode code = PR_GetError();
|
||||
mReadSegmentReturnValue = ErrorAccordingToNSPR(code);
|
||||
mReadSegmentBlocked = (code == PR_WOULD_BLOCK_ERROR);
|
||||
if (mReadSegmentBlocked) {
|
||||
return NS_BASE_STREAM_WOULD_BLOCK;
|
||||
}
|
||||
|
||||
return mReadSegmentReturnValue;
|
||||
nsresult rv = ErrorAccordingToNSPR(code);
|
||||
Close(rv);
|
||||
return rv;
|
||||
}
|
||||
aCount -= written;
|
||||
aData += written;
|
||||
|
@ -282,14 +287,9 @@ nsresult TLSFilterTransaction::OnWriteSegment(char *aData, uint32_t aCount,
|
|||
if (code == PR_WOULD_BLOCK_ERROR) {
|
||||
return NS_BASE_STREAM_WOULD_BLOCK;
|
||||
}
|
||||
// If reading from the socket succeeded (NS_SUCCEEDED(mFilterReadCode)),
|
||||
// but the nss layer encountered an error remember the error.
|
||||
if (NS_SUCCEEDED(mFilterReadCode)) {
|
||||
mFilterReadCode = ErrorAccordingToNSPR(code);
|
||||
LOG(("TLSFilterTransaction::OnWriteSegment %p nss error %" PRIx32 ".\n",
|
||||
this, mFilterReadCode));
|
||||
}
|
||||
return mFilterReadCode;
|
||||
nsresult rv = ErrorAccordingToNSPR(code);
|
||||
Close(rv);
|
||||
return rv;
|
||||
}
|
||||
*outCountRead = bytesRead;
|
||||
|
||||
|
@ -320,7 +320,7 @@ int32_t TLSFilterTransaction::FilterInput(char *aBuf, int32_t aAmount) {
|
|||
" read=%d input from net "
|
||||
"1 layer stripped, 1 still on\n",
|
||||
static_cast<uint32_t>(mFilterReadCode), outCountRead));
|
||||
if (mReadSegmentReturnValue == NS_BASE_STREAM_WOULD_BLOCK) {
|
||||
if (mReadSegmentBlocked) {
|
||||
mNudgeCounter = 0;
|
||||
}
|
||||
}
|
||||
|
@ -341,18 +341,19 @@ nsresult TLSFilterTransaction::ReadSegments(nsAHttpSegmentReader *aReader,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
mReadSegmentReturnValue = NS_OK;
|
||||
mReadSegmentBlocked = false;
|
||||
mSegmentReader = aReader;
|
||||
nsresult rv = mTransaction->ReadSegments(this, aCount, outCountRead);
|
||||
LOG(("TLSFilterTransaction %p called trans->ReadSegments rv=%" PRIx32 " %d\n",
|
||||
this, static_cast<uint32_t>(rv), *outCountRead));
|
||||
if (NS_SUCCEEDED(rv) && (mReadSegmentReturnValue == NS_BASE_STREAM_WOULD_BLOCK)) {
|
||||
if (NS_SUCCEEDED(rv) && mReadSegmentBlocked) {
|
||||
rv = NS_BASE_STREAM_WOULD_BLOCK;
|
||||
LOG(("TLSFilterTransaction %p read segment blocked found rv=%" PRIx32 "\n",
|
||||
this, static_cast<uint32_t>(rv)));
|
||||
Unused << Connection()->ForceSend();
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv) ? mReadSegmentReturnValue : rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult TLSFilterTransaction::WriteSegments(nsAHttpSegmentWriter *aWriter,
|
||||
|
@ -455,10 +456,8 @@ TLSFilterTransaction::Notify(nsITimer *timer) {
|
|||
if (timer != mTimer) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
nsresult rv = StartTimerCallback();
|
||||
if (NS_FAILED(rv)) {
|
||||
Close(rv);
|
||||
}
|
||||
DebugOnly<nsresult> rv = StartTimerCallback();
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -476,7 +475,7 @@ nsresult TLSFilterTransaction::StartTimerCallback() {
|
|||
// This class can be called re-entrantly, so cleanup m* before ->on()
|
||||
RefPtr<NudgeTunnelCallback> cb(mNudgeCallback);
|
||||
mNudgeCallback = nullptr;
|
||||
return cb->OnTunnelNudged(this);
|
||||
cb->OnTunnelNudged(this);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -100,11 +100,11 @@ class TLSFilterTransaction;
|
|||
|
||||
class NudgeTunnelCallback : public nsISupports {
|
||||
public:
|
||||
virtual nsresult OnTunnelNudged(TLSFilterTransaction *) = 0;
|
||||
virtual void OnTunnelNudged(TLSFilterTransaction *) = 0;
|
||||
};
|
||||
|
||||
#define NS_DECL_NUDGETUNNELCALLBACK \
|
||||
nsresult OnTunnelNudged(TLSFilterTransaction *) override;
|
||||
void OnTunnelNudged(TLSFilterTransaction *) override;
|
||||
|
||||
class TLSFilterTransaction final : public nsAHttpTransaction,
|
||||
public nsAHttpSegmentReader,
|
||||
|
@ -181,7 +181,7 @@ class TLSFilterTransaction final : public nsAHttpTransaction,
|
|||
|
||||
nsresult mFilterReadCode;
|
||||
bool mForce;
|
||||
nsresult mReadSegmentReturnValue;
|
||||
bool mReadSegmentBlocked;
|
||||
uint32_t mNudgeCounter;
|
||||
};
|
||||
|
||||
|
|
|
@ -701,14 +701,14 @@ npnComplete:
|
|||
return true;
|
||||
}
|
||||
|
||||
nsresult nsHttpConnection::OnTunnelNudged(TLSFilterTransaction *trans) {
|
||||
void nsHttpConnection::OnTunnelNudged(TLSFilterTransaction *trans) {
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
LOG(("nsHttpConnection::OnTunnelNudged %p\n", this));
|
||||
if (trans != mTLSFilter) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
LOG(("nsHttpConnection::OnTunnelNudged %p Calling OnSocketWritable\n", this));
|
||||
return OnSocketWritable();
|
||||
Unused << OnSocketWritable();
|
||||
}
|
||||
|
||||
// called on the socket thread
|
||||
|
|
Загрузка…
Ссылка в новой задаче