Skip to content

doc: AcceptedAlert::write doesn't necessarily write all bytes #1867

@jsha

Description

@jsha

The docs for AcceptedAlert::write() say "Send the alert to the client." Under the hood it calls ChunkVecBuffer::write_to, and returns the usize.

The problem is, &mut dyn Write is allowed to return short writes. So it's possible that write_to writes less than all of the ChunkVecBuffer's contents.

I think the correct user behavior is to call AcceptedAlert::write() in a loop until it returns Ok(0) or an error. Is that right? If so, examples/src/bin/server_acceptor.rs should be updated. And the docs should say "Send alert bytes to the client. Call this repeatedly until it returns Ok(0) or an error, to ensure all bytes are sent."

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