rename quicConn.earlySessionReady to quicConn.earlyConnReady

This commit is contained in:
Marten Seemann 2022-03-26 15:41:58 +01:00
parent 1ae835d1d8
commit a088ba4607
7 changed files with 21 additions and 21 deletions

View file

@ -311,7 +311,7 @@ func (c *client) dial(ctx context.Context) error {
// Otherwise, earlyConnChan will be nil. Receiving from a nil chan blocks forever. // Otherwise, earlyConnChan will be nil. Receiving from a nil chan blocks forever.
var earlyConnChan <-chan struct{} var earlyConnChan <-chan struct{}
if c.use0RTT { if c.use0RTT {
earlyConnChan = c.conn.earlySessionReady() earlyConnChan = c.conn.earlyConnReady()
} }
select { select {

View file

@ -285,7 +285,7 @@ var _ = Describe("Client", func() {
conn := NewMockQuicConn(mockCtrl) conn := NewMockQuicConn(mockCtrl)
conn.EXPECT().run().Do(func() { <-done }) conn.EXPECT().run().Do(func() { <-done })
conn.EXPECT().HandshakeComplete().Return(context.Background()) conn.EXPECT().HandshakeComplete().Return(context.Background())
conn.EXPECT().earlySessionReady().Return(readyChan) conn.EXPECT().earlyConnReady().Return(readyChan)
return conn return conn
} }

View file

@ -279,18 +279,18 @@ func (mr *MockQuicConnMockRecorder) destroy(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "destroy", reflect.TypeOf((*MockQuicConn)(nil).destroy), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "destroy", reflect.TypeOf((*MockQuicConn)(nil).destroy), arg0)
} }
// earlySessionReady mocks base method. // earlyConnReady mocks base method.
func (m *MockQuicConn) earlySessionReady() <-chan struct{} { func (m *MockQuicConn) earlyConnReady() <-chan struct{} {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "earlySessionReady") ret := m.ctrl.Call(m, "earlyConnReady")
ret0, _ := ret[0].(<-chan struct{}) ret0, _ := ret[0].(<-chan struct{})
return ret0 return ret0
} }
// earlySessionReady indicates an expected call of earlySessionReady. // earlyConnReady indicates an expected call of earlyConnReady.
func (mr *MockQuicConnMockRecorder) earlySessionReady() *gomock.Call { func (mr *MockQuicConnMockRecorder) earlyConnReady() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "earlySessionReady", reflect.TypeOf((*MockQuicConn)(nil).earlySessionReady)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "earlyConnReady", reflect.TypeOf((*MockQuicConn)(nil).earlyConnReady))
} }
// getPerspective mocks base method. // getPerspective mocks base method.

View file

@ -43,7 +43,7 @@ type packetHandlerManager interface {
type quicConn interface { type quicConn interface {
EarlyConnection EarlyConnection
earlySessionReady() <-chan struct{} earlyConnReady() <-chan struct{}
handlePacket(*receivedPacket) handlePacket(*receivedPacket)
GetVersion() protocol.VersionNumber GetVersion() protocol.VersionNumber
getPerspective() protocol.Perspective getPerspective() protocol.Perspective
@ -505,7 +505,7 @@ func (s *baseServer) handleNewConn(conn quicConn) {
if s.acceptEarlyConns { if s.acceptEarlyConns {
// wait until the early connection is ready (or the handshake fails) // wait until the early connection is ready (or the handshake fails)
select { select {
case <-conn.earlySessionReady(): case <-conn.earlyConnReady():
case <-sessCtx.Done(): case <-sessCtx.Done():
return return
} }

View file

@ -1027,7 +1027,7 @@ var _ = Describe("Server", func() {
Expect(enable0RTT).To(BeTrue()) Expect(enable0RTT).To(BeTrue())
conn.EXPECT().handlePacket(gomock.Any()) conn.EXPECT().handlePacket(gomock.Any())
conn.EXPECT().run().Do(func() {}) conn.EXPECT().run().Do(func() {})
conn.EXPECT().earlySessionReady().Return(ready) conn.EXPECT().earlyConnReady().Return(ready)
conn.EXPECT().Context().Return(context.Background()) conn.EXPECT().Context().Return(context.Background())
return conn return conn
} }
@ -1072,7 +1072,7 @@ var _ = Describe("Server", func() {
conn := NewMockQuicConn(mockCtrl) conn := NewMockQuicConn(mockCtrl)
conn.EXPECT().handlePacket(gomock.Any()) conn.EXPECT().handlePacket(gomock.Any())
conn.EXPECT().run() conn.EXPECT().run()
conn.EXPECT().earlySessionReady().Return(ready) conn.EXPECT().earlyConnReady().Return(ready)
conn.EXPECT().Context().Return(context.Background()) conn.EXPECT().Context().Return(context.Background())
return conn return conn
} }
@ -1133,7 +1133,7 @@ var _ = Describe("Server", func() {
) quicConn { ) quicConn {
conn.EXPECT().handlePacket(p) conn.EXPECT().handlePacket(p)
conn.EXPECT().run() conn.EXPECT().run()
conn.EXPECT().earlySessionReady() conn.EXPECT().earlyConnReady()
conn.EXPECT().Context().Return(ctx) conn.EXPECT().Context().Return(ctx)
close(connCreated) close(connCreated)
return conn return conn

View file

@ -188,7 +188,7 @@ type session struct {
undecryptablePacketsToProcess []*receivedPacket undecryptablePacketsToProcess []*receivedPacket
clientHelloWritten <-chan *wire.TransportParameters clientHelloWritten <-chan *wire.TransportParameters
earlySessionReadyChan chan struct{} earlyConnReadyChan chan struct{}
handshakeCompleteChan chan struct{} // is closed when the handshake completes handshakeCompleteChan chan struct{} // is closed when the handshake completes
handshakeComplete bool handshakeComplete bool
handshakeConfirmed bool handshakeConfirmed bool
@ -511,7 +511,7 @@ func (s *session) preSetup() {
s.rttStats, s.rttStats,
s.logger, s.logger,
) )
s.earlySessionReadyChan = make(chan struct{}) s.earlyConnReadyChan = make(chan struct{})
s.streamsMap = newStreamsMap( s.streamsMap = newStreamsMap(
s, s,
s.newFlowController, s.newFlowController,
@ -555,7 +555,7 @@ func (s *session) run() error {
s.scheduleSending() s.scheduleSending()
if zeroRTTParams != nil { if zeroRTTParams != nil {
s.restoreTransportParameters(zeroRTTParams) s.restoreTransportParameters(zeroRTTParams)
close(s.earlySessionReadyChan) close(s.earlyConnReadyChan)
} }
case closeErr := <-s.closeChan: case closeErr := <-s.closeChan:
// put the close error back into the channel, so that the run loop can receive it // put the close error back into the channel, so that the run loop can receive it
@ -705,8 +705,8 @@ runLoop:
} }
// blocks until the early session can be used // blocks until the early session can be used
func (s *session) earlySessionReady() <-chan struct{} { func (s *session) earlyConnReady() <-chan struct{} {
return s.earlySessionReadyChan return s.earlyConnReadyChan
} }
func (s *session) HandshakeComplete() context.Context { func (s *session) HandshakeComplete() context.Context {
@ -1575,7 +1575,7 @@ func (s *session) handleTransportParameters(params *wire.TransportParameters) {
s.applyTransportParameters() s.applyTransportParameters()
// On the server side, the early session is ready as soon as we processed // On the server side, the early session is ready as soon as we processed
// the client's transport parameters. // the client's transport parameters.
close(s.earlySessionReadyChan) close(s.earlyConnReadyChan)
} }
} }

View file

@ -2077,12 +2077,12 @@ var _ = Describe("Connection", func() {
streamManager.EXPECT().UpdateLimits(params) streamManager.EXPECT().UpdateLimits(params)
packer.EXPECT().HandleTransportParameters(params) packer.EXPECT().HandleTransportParameters(params)
packer.EXPECT().PackCoalescedPacket().MaxTimes(3) packer.EXPECT().PackCoalescedPacket().MaxTimes(3)
Expect(sess.earlySessionReady()).ToNot(BeClosed()) Expect(sess.earlyConnReady()).ToNot(BeClosed())
connRunner.EXPECT().GetStatelessResetToken(gomock.Any()).Times(2) connRunner.EXPECT().GetStatelessResetToken(gomock.Any()).Times(2)
connRunner.EXPECT().Add(gomock.Any(), sess).Times(2) connRunner.EXPECT().Add(gomock.Any(), sess).Times(2)
tracer.EXPECT().ReceivedTransportParameters(params) tracer.EXPECT().ReceivedTransportParameters(params)
sess.handleTransportParameters(params) sess.handleTransportParameters(params)
Expect(sess.earlySessionReady()).To(BeClosed()) Expect(sess.earlyConnReady()).To(BeClosed())
}) })
}) })