mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
introduce a quic.StreamError type and use it for stream cancelations
This commit is contained in:
parent
93cfef57ca
commit
90727cb41a
26 changed files with 128 additions and 114 deletions
11
interface.go
11
interface.go
|
@ -104,7 +104,7 @@ type ReceiveStream interface {
|
|||
// It will ask the peer to stop transmitting stream data.
|
||||
// Read will unblock immediately, and future Read calls will fail.
|
||||
// When called multiple times or after reading the io.EOF it is a no-op.
|
||||
CancelRead(ApplicationErrorCode)
|
||||
CancelRead(StreamErrorCode)
|
||||
// SetReadDeadline sets the deadline for future Read calls and
|
||||
// any currently-blocked Read call.
|
||||
// A zero value for t means Read will not time out.
|
||||
|
@ -133,7 +133,7 @@ type SendStream interface {
|
|||
// Data already written, but not yet delivered to the peer is not guaranteed to be delivered reliably.
|
||||
// Write will unblock immediately, and future calls to Write will fail.
|
||||
// When called multiple times or after closing the stream it is a no-op.
|
||||
CancelWrite(ApplicationErrorCode)
|
||||
CancelWrite(StreamErrorCode)
|
||||
// The context is canceled as soon as the write-side of the stream is closed.
|
||||
// This happens when Close() or CancelWrite() is called, or when the peer
|
||||
// cancels the read-side of their stream.
|
||||
|
@ -147,13 +147,6 @@ type SendStream interface {
|
|||
SetWriteDeadline(t time.Time) error
|
||||
}
|
||||
|
||||
// StreamError is returned by Read and Write when the peer cancels the stream.
|
||||
type StreamError interface {
|
||||
error
|
||||
Canceled() bool
|
||||
ErrorCode() ApplicationErrorCode
|
||||
}
|
||||
|
||||
// A Session is a QUIC connection between two peers.
|
||||
type Session interface {
|
||||
// AcceptStream returns the next stream opened by the peer, blocking until one is available.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue