add a context to Session.Accept{Uni}Stream

This commit is contained in:
Marten Seemann 2019-05-28 17:32:18 +01:00
parent f74082b2fb
commit 5550ba2c3b
28 changed files with 140 additions and 105 deletions

View file

@ -1,6 +1,7 @@
package quic
import (
"context"
"errors"
"fmt"
"net"
@ -123,13 +124,13 @@ func (m *streamsMap) OpenUniStreamSync() (SendStream, error) {
return str, convertStreamError(err, protocol.StreamTypeUni, m.perspective)
}
func (m *streamsMap) AcceptStream() (Stream, error) {
str, err := m.incomingBidiStreams.AcceptStream()
func (m *streamsMap) AcceptStream(ctx context.Context) (Stream, error) {
str, err := m.incomingBidiStreams.AcceptStream(ctx)
return str, convertStreamError(err, protocol.StreamTypeBidi, m.perspective.Opposite())
}
func (m *streamsMap) AcceptUniStream() (ReceiveStream, error) {
str, err := m.incomingUniStreams.AcceptStream()
func (m *streamsMap) AcceptUniStream(ctx context.Context) (ReceiveStream, error) {
str, err := m.incomingUniStreams.AcceptStream(ctx)
return str, convertStreamError(err, protocol.StreamTypeUni, m.perspective.Opposite())
}