From 04147d86da53f3e7cd9cff8b301107f21a8b3ac7 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 11 Aug 2018 12:24:51 +0700 Subject: [PATCH] rename the cryptoStreamI interface to cryptoStream --- crypto_stream.go | 12 ++++++------ crypto_stream_test.go | 4 ++-- mock_quic_session_test.go | 4 ++-- mockgen.go | 2 +- server.go | 2 +- session.go | 6 +++--- session_test.go | 2 +- stream_framer.go | 4 ++-- window_update_queue.go | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/crypto_stream.go b/crypto_stream.go index 8e96ec10..6e8ca9ed 100644 --- a/crypto_stream.go +++ b/crypto_stream.go @@ -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 } diff --git a/crypto_stream_test.go b/crypto_stream_test.go index d5ec3bef..583ba742 100644 --- a/crypto_stream_test.go +++ b/crypto_stream_test.go @@ -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() { diff --git a/mock_quic_session_test.go b/mock_quic_session_test.go index 3cbb6383..4cd40ab7 100644 --- a/mock_quic_session_test.go +++ b/mock_quic_session_test.go @@ -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 } diff --git a/mockgen.go b/mockgen.go index 9c0e08b8..7e8f3278 100644 --- a/mockgen.go +++ b/mockgen.go @@ -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" diff --git a/server.go b/server.go index e6317556..f0946567 100644 --- a/server.go +++ b/server.go @@ -39,7 +39,7 @@ type packetHandlerManager interface { type quicSession interface { Session handlePacket(*receivedPacket) - getCryptoStream() cryptoStreamI + getCryptoStream() cryptoStream GetVersion() protocol.VersionNumber run() error destroy(error) diff --git a/session.go b/session.go index 928cd141..4df85efa 100644 --- a/session.go +++ b/session.go @@ -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 } diff --git a/session_test.go b/session_test.go index 300b2c53..bef8ad6f 100644 --- a/session_test.go +++ b/session_test.go @@ -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, diff --git a/stream_framer.go b/stream_framer.go index c453f864..aabfac9f 100644 --- a/stream_framer.go +++ b/stream_framer.go @@ -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 { diff --git a/window_update_queue.go b/window_update_queue.go index dfbc45ab..6cd359e5 100644 --- a/window_update_queue.go +++ b/window_update_queue.go @@ -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 {