forked from quic-go/quic-go
remove GetOrOpenStream from Session interface
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type streamCreator interface {
|
type streamCreator interface {
|
||||||
|
AcceptStream() (utils.Stream, error)
|
||||||
GetOrOpenStream(protocol.StreamID) (utils.Stream, error)
|
GetOrOpenStream(protocol.StreamID) (utils.Stream, error)
|
||||||
Close(error) error
|
Close(error) error
|
||||||
RemoteAddr() net.Addr
|
RemoteAddr() net.Addr
|
||||||
@@ -91,7 +92,7 @@ func (s *Server) serveImpl(tlsConfig *tls.Config, conn *net.UDPConn) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleStreamCb(session quic.Session, stream utils.Stream) {
|
func (s *Server) handleStreamCb(session quic.Session, stream utils.Stream) {
|
||||||
s.handleStream(session, stream)
|
s.handleStream(session.(streamCreator), stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleStream(session streamCreator, stream utils.Stream) {
|
func (s *Server) handleStream(session streamCreator, stream utils.Stream) {
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ type mockSession struct {
|
|||||||
func (s *mockSession) GetOrOpenStream(id protocol.StreamID) (utils.Stream, error) {
|
func (s *mockSession) GetOrOpenStream(id protocol.StreamID) (utils.Stream, error) {
|
||||||
return s.dataStream, nil
|
return s.dataStream, nil
|
||||||
}
|
}
|
||||||
|
func (s *mockSession) AcceptStream() (utils.Stream, error) {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
func (s *mockSession) Close(e error) error {
|
func (s *mockSession) Close(e error) error {
|
||||||
s.closed = true
|
s.closed = true
|
||||||
s.closedWithError = e
|
s.closedWithError = e
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package quic
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/lucas-clemente/quic-go/protocol"
|
|
||||||
"github.com/lucas-clemente/quic-go/utils"
|
"github.com/lucas-clemente/quic-go/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,6 +19,4 @@ type Session interface {
|
|||||||
// OpenStreamSync() (utils.Stream, error)
|
// OpenStreamSync() (utils.Stream, error)
|
||||||
RemoteAddr() net.Addr
|
RemoteAddr() net.Addr
|
||||||
Close(error) error
|
Close(error) error
|
||||||
// TODO: remove this
|
|
||||||
GetOrOpenStream(protocol.StreamID) (utils.Stream, error)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user