[+] Added explicit stream interface cache reset path under proto stacks

(amended: missed one discard)
This commit is contained in:
Reece Wilson 2023-06-11 15:09:07 +01:00
parent 98c1235554
commit 1f505fcf02
3 changed files with 16 additions and 1 deletions

View File

@ -110,6 +110,8 @@ namespace Aurora::IO::Protocol
if (this->pParent->pTopPiece.get() == this)
{
this->pParent->pTopPiece = AuReinterpretCast<ProtocolPiece>(pLast);
this->pParent->bWrittenEnd = false;
}
if (this->pParent->pBottomPiece.get() == this)
@ -118,6 +120,7 @@ namespace Aurora::IO::Protocol
}
this->PrivateUserDataClear();
this->pParent->DiscardAllocCaches();
this->pParent = nullptr;
}

View File

@ -179,6 +179,8 @@ namespace Aurora::IO::Protocol
}
}
this->DiscardAllocCaches();
return pNew;
}
@ -304,6 +306,8 @@ namespace Aurora::IO::Protocol
}
}
this->DiscardAllocCaches();
return pNew;
}
@ -399,6 +403,7 @@ namespace Aurora::IO::Protocol
}
this->bWrittenEnd = true;
this->DiscardAllocCaches();
return pNew;
}
@ -497,7 +502,6 @@ namespace Aurora::IO::Protocol
return this->pStreamReaderCache;
}
struct A : AuIO::Buffered::BlobReader
{
AuWPtr<ProtocolStack> wpStack;
@ -703,6 +707,12 @@ namespace Aurora::IO::Protocol
return {};
}
void ProtocolStack::DiscardAllocCaches()
{
AuResetMember(this->pStreamReaderCache);
AuResetMember(this->pStreamWriterCache);
}
AUKN_SYM AuSPtr<IProtocolStack> NewBufferedProtocolStack(AuUInt uLength)
{
if (!uLength)

View File

@ -63,5 +63,7 @@ namespace Aurora::IO::Protocol
AuSPtr<IStreamReader> pStreamReaderCache;
AuSPtr<IStreamWriter> pStreamWriterCache;
void DiscardAllocCaches();
};
}