remove GetOrOpenStream from Session interface

This commit is contained in:
Marten Seemann
2017-02-17 13:58:47 +07:00
parent a96211f724
commit 532d3caed1
3 changed files with 5 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import (
)
type streamCreator interface {
AcceptStream() (utils.Stream, error)
GetOrOpenStream(protocol.StreamID) (utils.Stream, error)
Close(error) error
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) {
s.handleStream(session, stream)
s.handleStream(session.(streamCreator), stream)
}
func (s *Server) handleStream(session streamCreator, stream utils.Stream) {

View File

@@ -31,6 +31,9 @@ type mockSession struct {
func (s *mockSession) GetOrOpenStream(id protocol.StreamID) (utils.Stream, error) {
return s.dataStream, nil
}
func (s *mockSession) AcceptStream() (utils.Stream, error) {
panic("not implemented")
}
func (s *mockSession) Close(e error) error {
s.closed = true
s.closedWithError = e

View File

@@ -3,7 +3,6 @@ package quic
import (
"net"
"github.com/lucas-clemente/quic-go/protocol"
"github.com/lucas-clemente/quic-go/utils"
)
@@ -20,6 +19,4 @@ type Session interface {
// OpenStreamSync() (utils.Stream, error)
RemoteAddr() net.Addr
Close(error) error
// TODO: remove this
GetOrOpenStream(protocol.StreamID) (utils.Stream, error)
}