Skip to content

SslStream should avoid copying read buffer data when it already has another frame to process #49086

@geoffkizer

Description

@geoffkizer

The logic in SslStream.ReadAsyncInternal calls ResetReadBuffer whenever it finishes processing the previous decrypted frame and thus needs to decrypt another frame. However, this is unnecessarily aggressive. We should only do this when we are about to actually issue a read against the underlying stream. If we already have a frame buffered, then we won't read and will just process that frame immediately, which means the copy was pointless.

This might be a good reason to use ArrayBuffer here, since it simplifies some of the buffer management.

Related to #49000
Related to #49019

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions