rename the cryptoStreamI interface to cryptoStream

This commit is contained in:
Marten Seemann 2018-08-11 12:24:51 +07:00
parent 40050f558d
commit 04147d86da
9 changed files with 20 additions and 20 deletions

View file

@ -8,7 +8,7 @@ import (
"github.com/lucas-clemente/quic-go/internal/wire"
)
type cryptoStreamI interface {
type cryptoStream interface {
StreamID() protocol.StreamID
io.Reader
io.Writer
@ -21,21 +21,21 @@ type cryptoStreamI interface {
handleMaxStreamDataFrame(*wire.MaxStreamDataFrame)
}
type cryptoStream struct {
type cryptoStreamImpl struct {
*stream
}
var _ cryptoStreamI = &cryptoStream{}
var _ cryptoStream = &cryptoStreamImpl{}
func newCryptoStream(sender streamSender, flowController flowcontrol.StreamFlowController, version protocol.VersionNumber) cryptoStreamI {
func newCryptoStream(sender streamSender, flowController flowcontrol.StreamFlowController, version protocol.VersionNumber) cryptoStream {
str := newStream(version.CryptoStreamID(), sender, flowController, version)
return &cryptoStream{str}
return &cryptoStreamImpl{str}
}
// SetReadOffset sets the read offset.
// It is only needed for the crypto stream.
// It must not be called concurrently with any other stream methods, especially Read and Write.
func (s *cryptoStream) setReadOffset(offset protocol.ByteCount) {
func (s *cryptoStreamImpl) setReadOffset(offset protocol.ByteCount) {
s.receiveStream.readOffset = offset
s.receiveStream.frameQueue.readPosition = offset
}

View file

@ -9,13 +9,13 @@ import (
var _ = Describe("Crypto Stream", func() {
var (
str *cryptoStream
str *cryptoStreamImpl
mockSender *MockStreamSender
)
BeforeEach(func() {
mockSender = NewMockStreamSender(mockCtrl)
str = newCryptoStream(mockSender, nil, protocol.VersionWhatever).(*cryptoStream)
str = newCryptoStream(mockSender, nil, protocol.VersionWhatever).(*cryptoStreamImpl)
})
It("sets the read offset", func() {

View file

@ -220,9 +220,9 @@ func (mr *MockQuicSessionMockRecorder) destroy(arg0 interface{}) *gomock.Call {
}
// getCryptoStream mocks base method
func (m *MockQuicSession) getCryptoStream() cryptoStreamI {
func (m *MockQuicSession) getCryptoStream() cryptoStream {
ret := m.ctrl.Call(m, "getCryptoStream")
ret0, _ := ret[0].(cryptoStreamI)
ret0, _ := ret[0].(cryptoStream)
return ret0
}

View file

@ -6,7 +6,7 @@ package quic
//go:generate sh -c "./mockgen_private.sh quic mock_stream_sender_test.go github.com/lucas-clemente/quic-go streamSender StreamSender"
//go:generate sh -c "./mockgen_private.sh quic mock_stream_getter_test.go github.com/lucas-clemente/quic-go streamGetter StreamGetter"
//go:generate sh -c "./mockgen_private.sh quic mock_stream_frame_source_test.go github.com/lucas-clemente/quic-go streamFrameSource StreamFrameSource"
//go:generate sh -c "./mockgen_private.sh quic mock_crypto_stream_test.go github.com/lucas-clemente/quic-go cryptoStreamI CryptoStream"
//go:generate sh -c "./mockgen_private.sh quic mock_crypto_stream_test.go github.com/lucas-clemente/quic-go cryptoStream CryptoStream"
//go:generate sh -c "./mockgen_private.sh quic mock_stream_manager_test.go github.com/lucas-clemente/quic-go streamManager StreamManager"
//go:generate sh -c "./mockgen_private.sh quic mock_unpacker_test.go github.com/lucas-clemente/quic-go unpacker Unpacker"
//go:generate sh -c "./mockgen_private.sh quic mock_quic_aead_test.go github.com/lucas-clemente/quic-go quicAEAD QuicAEAD"

View file

@ -39,7 +39,7 @@ type packetHandlerManager interface {
type quicSession interface {
Session
handlePacket(*receivedPacket)
getCryptoStream() cryptoStreamI
getCryptoStream() cryptoStream
GetVersion() protocol.VersionNumber
run() error
destroy(error)

View file

@ -86,7 +86,7 @@ type session struct {
conn connection
streamsMap streamManager
cryptoStream cryptoStreamI
cryptoStream cryptoStream
rttStats *congestion.RTTStats
@ -1188,7 +1188,7 @@ func (s *session) newFlowController(id protocol.StreamID) flowcontrol.StreamFlow
)
}
func (s *session) newCryptoStream() cryptoStreamI {
func (s *session) newCryptoStream() cryptoStream {
id := s.version.CryptoStreamID()
flowController := flowcontrol.NewStreamFlowController(
id,
@ -1276,7 +1276,7 @@ func (s *session) RemoteAddr() net.Addr {
return s.conn.RemoteAddr()
}
func (s *session) getCryptoStream() cryptoStreamI {
func (s *session) getCryptoStream() cryptoStream {
return s.cryptoStream
}

View file

@ -345,7 +345,7 @@ var _ = Describe("Session", func() {
fc := mocks.NewMockStreamFlowController(mockCtrl)
offset := protocol.ByteCount(0x4321)
fc.EXPECT().UpdateSendWindow(offset)
sess.cryptoStream.(*cryptoStream).sendStream.flowController = fc
sess.cryptoStream.(*cryptoStreamImpl).sendStream.flowController = fc
err := sess.handleMaxStreamDataFrame(&wire.MaxStreamDataFrame{
StreamID: sess.version.CryptoStreamID(),
ByteOffset: offset,

View file

@ -9,7 +9,7 @@ import (
type streamFramer struct {
streamGetter streamGetter
cryptoStream cryptoStreamI
cryptoStream cryptoStream
version protocol.VersionNumber
streamQueueMutex sync.Mutex
@ -19,7 +19,7 @@ type streamFramer struct {
}
func newStreamFramer(
cryptoStream cryptoStreamI,
cryptoStream cryptoStream,
streamGetter streamGetter,
v protocol.VersionNumber,
) *streamFramer {

View file

@ -14,7 +14,7 @@ type windowUpdateQueue struct {
queue map[protocol.StreamID]bool // used as a set
queuedConn bool // connection-level window update
cryptoStream cryptoStreamI
cryptoStream cryptoStream
streamGetter streamGetter
connFlowController flowcontrol.ConnectionFlowController
callback func(wire.Frame)
@ -22,7 +22,7 @@ type windowUpdateQueue struct {
func newWindowUpdateQueue(
streamGetter streamGetter,
cryptoStream cryptoStreamI,
cryptoStream cryptoStream,
connFC flowcontrol.ConnectionFlowController,
cb func(wire.Frame),
) *windowUpdateQueue {