-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathwritablestream.go
More file actions
38 lines (29 loc) · 963 Bytes
/
Copy pathwritablestream.go
File metadata and controls
38 lines (29 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package quic
import (
"time"
"github.com/pion/quic/internal/wrapper"
quic "github.com/quic-go/quic-go"
)
// WritableStream represents a quic SendStream.
type WritableStream struct {
s *wrapper.WritableStream
}
// Write writes data to the stream.
func (s *WritableStream) Write(data StreamWriteParameters) error {
_, err := s.s.WriteQuic(data.Data, data.Finished)
return err
}
// StreamID returns the ID of the WritableStream.
func (s *WritableStream) StreamID() StreamID {
return StreamID(s.s.StreamID())
}
// SetWriteDeadline sets the deadline for future Write calls. A zero value for t means Write will not time out.
func (s *WritableStream) SetWriteDeadline(t time.Time) error {
return s.s.SetWriteDeadline(t)
}
// Detach detaches the underlying quic-go SendStream.
func (s *WritableStream) Detach() *quic.SendStream {
return s.s.Detach()
}