forked from pion/quic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
writablestream.go
34 lines (27 loc) · 851 Bytes
/
writablestream.go
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
package quic
import (
"time"
quic "github.com/lucas-clemente/quic-go"
"github.com/pion/quic/internal/wrapper"
)
// 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() uint64 {
return 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()
}