зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1835430 - Cancel async copy to avoid leaks, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181643
This commit is contained in:
Родитель
47a79d59b0
Коммит
d325869b9a
|
@ -2243,6 +2243,12 @@ void nsSocketTransport::OnSocketDetached(PRFileDesc* fd) {
|
|||
//
|
||||
mInput.OnSocketReady(mCondition);
|
||||
mOutput.OnSocketReady(mCondition);
|
||||
if (mInputCopyContext) {
|
||||
NS_CancelAsyncCopy(mInputCopyContext, mCondition);
|
||||
}
|
||||
if (mOutputCopyContext) {
|
||||
NS_CancelAsyncCopy(mOutputCopyContext, mCondition);
|
||||
}
|
||||
}
|
||||
|
||||
if (mCondition == NS_ERROR_NET_RESET && mDNSRecord &&
|
||||
|
@ -2334,7 +2340,8 @@ nsSocketTransport::OpenInputStream(uint32_t flags, uint32_t segsize,
|
|||
|
||||
// async copy from socket to pipe
|
||||
rv = NS_AsyncCopy(&mInput, pipeOut, mSocketTransportService,
|
||||
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize);
|
||||
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize, nullptr, nullptr,
|
||||
true, true, getter_AddRefs(mInputCopyContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
result = pipeIn;
|
||||
|
@ -2380,7 +2387,8 @@ nsSocketTransport::OpenOutputStream(uint32_t flags, uint32_t segsize,
|
|||
|
||||
// async copy from socket to pipe
|
||||
rv = NS_AsyncCopy(pipeIn, &mOutput, mSocketTransportService,
|
||||
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize);
|
||||
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize, nullptr, nullptr,
|
||||
true, true, getter_AddRefs(mOutputCopyContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
result = pipeOut;
|
||||
|
|
|
@ -307,6 +307,9 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
Atomic<bool> mInputClosed{true};
|
||||
Atomic<bool> mOutputClosed{true};
|
||||
|
||||
nsCOMPtr<nsISupports> mInputCopyContext;
|
||||
nsCOMPtr<nsISupports> mOutputCopyContext;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// members accessible only on the socket transport thread:
|
||||
// (the exception being initialization/shutdown time)
|
||||
|
|
Загрузка…
Ссылка в новой задаче