Skip to content

Converge config_ktls_{client,server} bounds to AsRawFd + AsyncRead + Unpin #76

Description

@imlk0

The two config functions (in version 6.0.2) have identical bodies but inconsistent, over-constrained bounds:

config_ktls_server:   IO: AsRawFd + AsyncRead + AsyncReadReady + AsyncWrite + Unpin
config_ktls_client:   IO: AsRawFd + AsyncRead + AsyncWrite + Unpin

Neither body uses AsyncWrite or AsyncReadReady. The only IO-touching operations are:

  • drain(&mut stream) — needs AsyncRead + Unpin
  • setup_inner(io.as_raw_fd(), ...) — needs AsRawFd
  • KtlsStream::new(io, drained) — needs AsRawFd

AsyncReadReady is never invoked inside either function (the only call site is CorkStream::poll_read_ready).

Proposal: converge both to the minimal set the bodies require:

where IO: AsRawFd + AsyncRead + Unpin,

This is a backward-compatible loosening.

In my use case, I have a wrapping IO type that impls AsRawFd + AsyncRead + Unpin but not AsyncReadReady can be passed to config_ktls_client today but is rejected by config_ktls_server purely on the redundant bound.

If AsyncReadReady was meant to guarantee the returned KtlsStream<IO> is usable as AsyncRead, that bound already lives on impl AsyncRead for KtlsStream<IO>. Maybe there is no need to duplicate it on the config function, and not on the client/server asymmetrically.

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