Open
Description
Proposal Details
Currently ssh channels does not support deadlines, so the only way to unblock reads/writes is to set a deadline on the underlying net.Conn
, but this will affect all channels using the connection.
Channels are typically blocked on reads while waiting for data and on writes while waiting for window capacity.
I propose adding deadlines to channels to fix these typically use cases, I don't think we can unblock reads/writes blocked on the underlying net.Conn
.
Proposed API
// ChannelWithDeadlines is a channel with deadlines support.
type ChannelWithDeadlines interface {
Channel
// SetDeadline sets the read and write deadlines associated with the
// channel. It is equivalent to calling both SetReadDeadline and
// SetWriteDeadline. Deadlines errors are not fatal, the Channel can be used
// again after resetting the deadlines.
SetDeadline(deadline time.Time) error
// SetReadDeadline sets the deadline for future Read calls and unblock Read
// calls waiting for data. A zero value for t means Read will not time out.
SetReadDeadline(deadline time.Time) error
// SetWriteDeadline sets the deadline for future Write calls and unblock
// Write calls waiting for window capacity. A zero value for t means Write
// will not time out.
SetWriteDeadline(deadline time.Time) error
}
cc @golang/proposal-review
Metadata
Metadata
Assignees
Type
Projects
Status
Incoming