forked from mirrors/gecko-dev
Bug 1818305 - Part 3: Check streamStatus from nsAStreamCopier, r=xpcom-reviewers,mccr8
This will ensure that errors in one side of a NS_AsyncCopy will more reliably propagate to the other side of the NS_AsyncCopy, by allowing us to check for situations like stream closure reliably even when the other side either has no available data, or no available space. Differential Revision: https://phabricator.services.mozilla.com/D170698
This commit is contained in:
parent
3b40268cc1
commit
ff7f4f17f4
1 changed files with 6 additions and 2 deletions
|
|
@ -530,7 +530,9 @@ class nsStreamCopierIB final : public nsAStreamCopier {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
*aSourceCondition =
|
*aSourceCondition =
|
||||||
mSource->ReadSegments(ConsumeInputBuffer, &state, mChunkSize, &n);
|
mSource->ReadSegments(ConsumeInputBuffer, &state, mChunkSize, &n);
|
||||||
*aSinkCondition = state.mSinkCondition;
|
*aSinkCondition = NS_SUCCEEDED(state.mSinkCondition) && n == 0
|
||||||
|
? mSink->StreamStatus()
|
||||||
|
: state.mSinkCondition;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -572,7 +574,9 @@ class nsStreamCopierOB final : public nsAStreamCopier {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
*aSinkCondition =
|
*aSinkCondition =
|
||||||
mSink->WriteSegments(FillOutputBuffer, &state, mChunkSize, &n);
|
mSink->WriteSegments(FillOutputBuffer, &state, mChunkSize, &n);
|
||||||
*aSourceCondition = state.mSourceCondition;
|
*aSourceCondition = NS_SUCCEEDED(state.mSourceCondition) && n == 0
|
||||||
|
? mSource->StreamStatus()
|
||||||
|
: state.mSourceCondition;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue