Skip to content

Factor out a BufferedInputStream and impl AsyncRead for it #23

Description

@pchickey

Right now we directly call input-stream.read in three places:

  • impl AsyncRead for TcpStream
  • impl AsyncRead for &TcpStream
  • impl AsyncRead for IncomingBody

In the first two impls we don't buffer and drop whatever doesn't fit into the buffer the user passed onto the floor.

In IncomingBody, a buffer is maintained for whatever the user doesn't take.

We should factor that buffer into a single BufferedInputStream in io::read, and reuse it in tcp and http.

Additionally, we can cache the Pollable for a given InputStream (as long as the fields are ordered so it gets dropped before its parent!) so we aren't subscribing and dropping that resource every time we wait for more input.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions