remove stream.CloseRemote from public API

This commit is contained in:
Lucas Clemente
2017-02-24 18:40:12 +01:00
parent 811bd20939
commit b2177c92d8
3 changed files with 7 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ import (
"sync/atomic"
"time"
"github.com/lucas-clemente/quic-go"
quic "github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/protocol"
"github.com/lucas-clemente/quic-go/qerr"
"github.com/lucas-clemente/quic-go/utils"
@@ -24,6 +24,10 @@ type streamCreator interface {
GetOrOpenStream(protocol.StreamID) (quic.Stream, error)
}
type remoteCloser interface {
CloseRemote(protocol.ByteCount)
}
// Server is a HTTP2 server listening for QUIC connections.
type Server struct {
*http.Server
@@ -173,7 +177,7 @@ func (s *Server) handleRequest(session streamCreator, headerStream quic.Stream,
var streamEnded bool
if h2headersFrame.StreamEnded() {
dataStream.CloseRemote(0)
dataStream.(remoteCloser).CloseRemote(0)
streamEnded = true
_, _ = dataStream.Read([]byte{0}) // read the eof
}

View File

@@ -14,7 +14,6 @@ type Stream interface {
io.Writer
io.Closer
StreamID() protocol.StreamID
CloseRemote(offset protocol.ByteCount)
Reset(error)
}

View File

@@ -1274,7 +1274,7 @@ var _ = Describe("Session", func() {
err = s.Close()
Expect(err).NotTo(HaveOccurred())
s.(*stream).sentFin()
s.CloseRemote(0)
s.(*stream).CloseRemote(0)
_, err = s.Read([]byte("a"))
Expect(err).To(MatchError(io.EOF))
sess.garbageCollectStreams()