From e71c236232cad376b84f330cb521350f5ce8f4f3 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 26 Mar 2022 14:35:01 +0100 Subject: [PATCH] rename the Session to Connection --- client.go | 8 ++-- config_test.go | 2 +- http3/server.go | 2 +- http3/server_test.go | 12 ++--- integrationtests/self/handshake_drop_test.go | 14 +++--- integrationtests/self/handshake_test.go | 2 +- integrationtests/self/mitm_test.go | 2 +- integrationtests/self/stream_test.go | 8 ++-- integrationtests/self/timeout_test.go | 2 +- integrationtests/self/uni_stream_test.go | 6 +-- interface.go | 50 ++++++++++---------- internal/mocks/quic/early_session.go | 4 +- internal/protocol/params.go | 8 ++-- interop/http09/server.go | 2 +- logging/types.go | 8 ++-- mock_quic_session_test.go | 4 +- server.go | 2 +- session.go | 6 +-- session_test.go | 4 +- 19 files changed, 73 insertions(+), 73 deletions(-) diff --git a/client.go b/client.go index 9dbe4ac5..75844fd6 100644 --- a/client.go +++ b/client.go @@ -56,7 +56,7 @@ func DialAddr( addr string, tlsConf *tls.Config, config *Config, -) (Session, error) { +) (Connection, error) { return DialAddrContext(context.Background(), addr, tlsConf, config) } @@ -95,7 +95,7 @@ func DialAddrContext( addr string, tlsConf *tls.Config, config *Config, -) (Session, error) { +) (Connection, error) { return dialAddrContext(ctx, addr, tlsConf, config, false) } @@ -131,7 +131,7 @@ func Dial( host string, tlsConf *tls.Config, config *Config, -) (Session, error) { +) (Connection, error) { return dialContext(context.Background(), pconn, remoteAddr, host, tlsConf, config, false, false) } @@ -172,7 +172,7 @@ func DialContext( host string, tlsConf *tls.Config, config *Config, -) (Session, error) { +) (Connection, error) { return dialContext(ctx, pconn, remoteAddr, host, tlsConf, config, false, false) } diff --git a/config_test.go b/config_test.go index a8574f8d..36f644e4 100644 --- a/config_test.go +++ b/config_test.go @@ -103,7 +103,7 @@ var _ = Describe("Config", func() { var calledAcceptToken, calledAllowConnectionWindowIncrease bool c1 := &Config{ AcceptToken: func(_ net.Addr, _ *Token) bool { calledAcceptToken = true; return true }, - AllowConnectionWindowIncrease: func(Session, uint64) bool { calledAllowConnectionWindowIncrease = true; return true }, + AllowConnectionWindowIncrease: func(Connection, uint64) bool { calledAllowConnectionWindowIncrease = true; return true }, } c2 := c1.Clone() c2.AcceptToken(&net.UDPAddr{}, &Token{}) diff --git a/http3/server.go b/http3/server.go index c5629a7e..ee10d819 100644 --- a/http3/server.go +++ b/http3/server.go @@ -439,7 +439,7 @@ func (s *Server) maxHeaderBytes() uint64 { return uint64(s.Server.MaxHeaderBytes) } -func (s *Server) handleRequest(sess quic.Session, str quic.Stream, decoder *qpack.Decoder, onFrameError func()) requestError { +func (s *Server) handleRequest(sess quic.Connection, str quic.Stream, decoder *qpack.Decoder, onFrameError func()) requestError { frame, err := parseNextFrame(str) if err != nil { return newStreamError(errorRequestIncomplete, err) diff --git a/http3/server_test.go b/http3/server_test.go index ffacba0a..b0e4d6e2 100644 --- a/http3/server_test.go +++ b/http3/server_test.go @@ -757,7 +757,7 @@ var _ = Describe("Server", func() { s.TLSConfig = &tls.Config{} stopAccept := make(chan struct{}) - ln.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Session, error) { + ln.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Connection, error) { <-stopAccept return nil, errors.New("closed") }) @@ -791,13 +791,13 @@ var _ = Describe("Server", func() { s.TLSConfig = &tls.Config{} stopAccept1 := make(chan struct{}) - ln1.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Session, error) { + ln1.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Connection, error) { <-stopAccept1 return nil, errors.New("closed") }) ln1.EXPECT().Addr() // generate alt-svc headers stopAccept2 := make(chan struct{}) - ln2.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Session, error) { + ln2.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Connection, error) { <-stopAccept2 return nil, errors.New("closed") }) @@ -845,7 +845,7 @@ var _ = Describe("Server", func() { s.TLSConfig = &tls.Config{} stopAccept := make(chan struct{}) - ln.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Session, error) { + ln.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Connection, error) { <-stopAccept return nil, errors.New("closed") }) @@ -880,13 +880,13 @@ var _ = Describe("Server", func() { s.TLSConfig = &tls.Config{} stopAccept1 := make(chan struct{}) - ln1.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Session, error) { + ln1.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Connection, error) { <-stopAccept1 return nil, errors.New("closed") }) ln1.EXPECT().Addr() // generate alt-svc headers stopAccept2 := make(chan struct{}) - ln2.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Session, error) { + ln2.EXPECT().Accept(gomock.Any()).DoAndReturn(func(context.Context) (quic.Connection, error) { <-stopAccept2 return nil, errors.New("closed") }) diff --git a/integrationtests/self/handshake_drop_test.go b/integrationtests/self/handshake_drop_test.go index f766660a..b82813d8 100644 --- a/integrationtests/self/handshake_drop_test.go +++ b/integrationtests/self/handshake_drop_test.go @@ -10,7 +10,7 @@ import ( "sync/atomic" "time" - quic "github.com/lucas-clemente/quic-go" + "github.com/lucas-clemente/quic-go" quicproxy "github.com/lucas-clemente/quic-go/integrationtests/tools/proxy" "github.com/lucas-clemente/quic-go/internal/protocol" @@ -71,7 +71,7 @@ var _ = Describe("Handshake drop tests", func() { clientSpeaksFirst := &applicationProtocol{ name: "client speaks first", run: func(version protocol.VersionNumber) { - serverSessionChan := make(chan quic.Session) + serverSessionChan := make(chan quic.Connection) go func() { defer GinkgoRecover() sess, err := ln.Accept(context.Background()) @@ -100,7 +100,7 @@ var _ = Describe("Handshake drop tests", func() { Expect(err).ToNot(HaveOccurred()) Expect(str.Close()).To(Succeed()) - var serverSession quic.Session + var serverSession quic.Connection Eventually(serverSessionChan, timeout).Should(Receive(&serverSession)) sess.CloseWithError(0, "") serverSession.CloseWithError(0, "") @@ -110,7 +110,7 @@ var _ = Describe("Handshake drop tests", func() { serverSpeaksFirst := &applicationProtocol{ name: "server speaks first", run: func(version protocol.VersionNumber) { - serverSessionChan := make(chan quic.Session) + serverSessionChan := make(chan quic.Connection) go func() { defer GinkgoRecover() sess, err := ln.Accept(context.Background()) @@ -138,7 +138,7 @@ var _ = Describe("Handshake drop tests", func() { Expect(err).ToNot(HaveOccurred()) Expect(b).To(Equal(data)) - var serverSession quic.Session + var serverSession quic.Connection Eventually(serverSessionChan, timeout).Should(Receive(&serverSession)) sess.CloseWithError(0, "") serverSession.CloseWithError(0, "") @@ -148,7 +148,7 @@ var _ = Describe("Handshake drop tests", func() { nobodySpeaks := &applicationProtocol{ name: "nobody speaks", run: func(version protocol.VersionNumber) { - serverSessionChan := make(chan quic.Session) + serverSessionChan := make(chan quic.Connection) go func() { defer GinkgoRecover() sess, err := ln.Accept(context.Background()) @@ -165,7 +165,7 @@ var _ = Describe("Handshake drop tests", func() { }), ) Expect(err).ToNot(HaveOccurred()) - var serverSession quic.Session + var serverSession quic.Connection Eventually(serverSessionChan, timeout).Should(Receive(&serverSession)) // both server and client accepted a session. Close now. sess.CloseWithError(0, "") diff --git a/integrationtests/self/handshake_test.go b/integrationtests/self/handshake_test.go index 75af2ea9..8f238ff3 100644 --- a/integrationtests/self/handshake_test.go +++ b/integrationtests/self/handshake_test.go @@ -329,7 +329,7 @@ var _ = Describe("Handshake tests", func() { pconn net.PacketConn ) - dial := func() (quic.Session, error) { + dial := func() (quic.Connection, error) { remoteAddr := fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port) raddr, err := net.ResolveUDPAddr("udp", remoteAddr) Expect(err).ToNot(HaveOccurred()) diff --git a/integrationtests/self/mitm_test.go b/integrationtests/self/mitm_test.go index b0078c0f..9ec62078 100644 --- a/integrationtests/self/mitm_test.go +++ b/integrationtests/self/mitm_test.go @@ -31,7 +31,7 @@ var _ = Describe("MITM test", func() { var ( proxy *quicproxy.QuicProxy serverConn, clientConn *net.UDPConn - serverSess quic.Session + serverSess quic.Connection serverConfig *quic.Config ) diff --git a/integrationtests/self/stream_test.go b/integrationtests/self/stream_test.go index b67ddc22..507e25f9 100644 --- a/integrationtests/self/stream_test.go +++ b/integrationtests/self/stream_test.go @@ -7,7 +7,7 @@ import ( "net" "sync" - quic "github.com/lucas-clemente/quic-go" + "github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go/internal/protocol" . "github.com/onsi/ginkgo" @@ -42,7 +42,7 @@ var _ = Describe("Bidirectional streams", func() { server.Close() }) - runSendingPeer := func(sess quic.Session) { + runSendingPeer := func(sess quic.Connection) { var wg sync.WaitGroup wg.Add(numStreams) for i := 0; i < numStreams; i++ { @@ -66,7 +66,7 @@ var _ = Describe("Bidirectional streams", func() { wg.Wait() } - runReceivingPeer := func(sess quic.Session) { + runReceivingPeer := func(sess quic.Connection) { var wg sync.WaitGroup wg.Add(numStreams) for i := 0; i < numStreams; i++ { @@ -88,7 +88,7 @@ var _ = Describe("Bidirectional streams", func() { } It(fmt.Sprintf("client opening %d streams to a server", numStreams), func() { - var sess quic.Session + var sess quic.Connection go func() { defer GinkgoRecover() var err error diff --git a/integrationtests/self/timeout_test.go b/integrationtests/self/timeout_test.go index 52a10bc2..076256ed 100644 --- a/integrationtests/self/timeout_test.go +++ b/integrationtests/self/timeout_test.go @@ -404,7 +404,7 @@ var _ = Describe("Timeout tests", func() { return err } - runClient := func(sess quic.Session) error { + runClient := func(sess quic.Connection) error { str, err := sess.AcceptUniStream(context.Background()) if err != nil { return err diff --git a/integrationtests/self/uni_stream_test.go b/integrationtests/self/uni_stream_test.go index db63da80..8de1b2d2 100644 --- a/integrationtests/self/uni_stream_test.go +++ b/integrationtests/self/uni_stream_test.go @@ -7,7 +7,7 @@ import ( "net" "sync" - quic "github.com/lucas-clemente/quic-go" + "github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go/internal/protocol" . "github.com/onsi/ginkgo" @@ -39,7 +39,7 @@ var _ = Describe("Unidirectional Streams", func() { return GeneratePRData(10 * int(id)) } - runSendingPeer := func(sess quic.Session) { + runSendingPeer := func(sess quic.Connection) { for i := 0; i < numStreams; i++ { str, err := sess.OpenUniStreamSync(context.Background()) Expect(err).ToNot(HaveOccurred()) @@ -52,7 +52,7 @@ var _ = Describe("Unidirectional Streams", func() { } } - runReceivingPeer := func(sess quic.Session) { + runReceivingPeer := func(sess quic.Connection) { var wg sync.WaitGroup wg.Add(numStreams) for i := 0; i < numStreams; i++ { diff --git a/interface.go b/interface.go index 5b340668..4c7ceebf 100644 --- a/interface.go +++ b/interface.go @@ -59,15 +59,15 @@ type TokenStore interface { // when the server rejects a 0-RTT connection attempt. var Err0RTTRejected = errors.New("0-RTT rejected") -// SessionTracingKey can be used to associate a ConnectionTracer with a Session. -// It is set on the Session.Context() context, +// SessionTracingKey can be used to associate a ConnectionTracer with a Connection. +// It is set on the Connection.Context() context, // as well as on the context passed to logging.Tracer.NewConnectionTracer. var SessionTracingKey = sessionTracingCtxKey{} type sessionTracingCtxKey struct{} // Stream is the interface implemented by QUIC streams -// In addition to the errors listed on the Session, +// In addition to the errors listed on the Connection, // calls to stream functions can return a StreamError if the stream is canceled. type Stream interface { ReceiveStream @@ -87,7 +87,7 @@ type ReceiveStream interface { // after a fixed time limit; see SetDeadline and SetReadDeadline. // If the stream was canceled by the peer, the error implements the StreamError // interface, and Canceled() == true. - // If the session was closed due to a timeout, the error satisfies + // If the connection was closed due to a timeout, the error satisfies // the net.Error interface, and Timeout() will be true. io.Reader // CancelRead aborts receiving on this stream. @@ -111,7 +111,7 @@ type SendStream interface { // after a fixed time limit; see SetDeadline and SetWriteDeadline. // If the stream was canceled by the peer, the error implements the StreamError // interface, and Canceled() == true. - // If the session was closed due to a timeout, the error satisfies + // If the connection was closed due to a timeout, the error satisfies // the net.Error interface, and Timeout() will be true. io.Writer // Close closes the write-direction of the stream. @@ -137,21 +137,21 @@ type SendStream interface { SetWriteDeadline(t time.Time) error } -// A Session is a QUIC connection between two peers. -// Calls to the session (and to streams) can return the following types of errors: +// A Connection is a QUIC connection between two peers. +// Calls to the connection (and to streams) can return the following types of errors: // * ApplicationError: for errors triggered by the application running on top of QUIC // * TransportError: for errors triggered by the QUIC transport (in many cases a misbehaving peer) // * IdleTimeoutError: when the peer goes away unexpectedly (this is a net.Error timeout error) // * HandshakeTimeoutError: when the cryptographic handshake takes too long (this is a net.Error timeout error) // * StatelessResetError: when we receive a stateless reset (this is a net.Error temporary error) // * VersionNegotiationError: returned by the client, when there's no version overlap between the peers -type Session interface { +type Connection interface { // AcceptStream returns the next stream opened by the peer, blocking until one is available. - // If the session was closed due to a timeout, the error satisfies + // If the connection was closed due to a timeout, the error satisfies // the net.Error interface, and Timeout() will be true. AcceptStream(context.Context) (Stream, error) // AcceptUniStream returns the next unidirectional stream opened by the peer, blocking until one is available. - // If the session was closed due to a timeout, the error satisfies + // If the connection was closed due to a timeout, the error satisfies // the net.Error interface, and Timeout() will be true. AcceptUniStream(context.Context) (ReceiveStream, error) // OpenStream opens a new bidirectional QUIC stream. @@ -159,22 +159,22 @@ type Session interface { // The peer can only accept the stream after data has been sent on the stream. // If the error is non-nil, it satisfies the net.Error interface. // When reaching the peer's stream limit, err.Temporary() will be true. - // If the session was closed due to a timeout, Timeout() will be true. + // If the connection was closed due to a timeout, Timeout() will be true. OpenStream() (Stream, error) // OpenStreamSync opens a new bidirectional QUIC stream. // It blocks until a new stream can be opened. // If the error is non-nil, it satisfies the net.Error interface. - // If the session was closed due to a timeout, Timeout() will be true. + // If the connection was closed due to a timeout, Timeout() will be true. OpenStreamSync(context.Context) (Stream, error) // OpenUniStream opens a new outgoing unidirectional QUIC stream. // If the error is non-nil, it satisfies the net.Error interface. // When reaching the peer's stream limit, Temporary() will be true. - // If the session was closed due to a timeout, Timeout() will be true. + // If the connection was closed due to a timeout, Timeout() will be true. OpenUniStream() (SendStream, error) // OpenUniStreamSync opens a new outgoing unidirectional QUIC stream. // It blocks until a new stream can be opened. // If the error is non-nil, it satisfies the net.Error interface. - // If the session was closed due to a timeout, Timeout() will be true. + // If the connection was closed due to a timeout, Timeout() will be true. OpenUniStreamSync(context.Context) (SendStream, error) // LocalAddr returns the local address. LocalAddr() net.Addr @@ -183,7 +183,7 @@ type Session interface { // CloseWithError closes the connection with an error. // The error string will be sent to the peer. CloseWithError(ApplicationErrorCode, string) error - // The context is cancelled when the session is closed. + // The context is cancelled when the connection is closed. // Warning: This API should not be considered stable and might change soon. Context() context.Context // ConnectionState returns basic details about the QUIC connection. @@ -199,19 +199,19 @@ type Session interface { ReceiveMessage() ([]byte, error) } -// An EarlySession is a session that is handshaking. +// An EarlySession is a connection that is handshaking. // Data sent during the handshake is encrypted using the forward secure keys. // When using client certificates, the client's identity is only verified // after completion of the handshake. type EarlySession interface { - Session + Connection // HandshakeComplete blocks until the handshake completes (or fails). // Data sent before completion of the handshake is encrypted with 1-RTT keys. // Note that the client's identity hasn't been verified yet. HandshakeComplete() context.Context - NextSession() Session + NextSession() Connection } // Config contains all configuration data needed for a QUIC server or client. @@ -270,9 +270,9 @@ type Config struct { // to increase the connection flow control window. // If set, the caller can prevent an increase of the window. Typically, it would do so to // limit the memory usage. - // To avoid deadlocks, it is not valid to call other functions on the session or on streams + // To avoid deadlocks, it is not valid to call other functions on the connection or on streams // in this callback. - AllowConnectionWindowIncrease func(sess Session, delta uint64) bool + AllowConnectionWindowIncrease func(sess Connection, delta uint64) bool // MaxIncomingStreams is the maximum number of concurrent bidirectional streams that a peer is allowed to open. // Values above 2^60 are invalid. // If not set, it will default to 100. @@ -310,21 +310,21 @@ type ConnectionState struct { // A Listener for incoming QUIC connections type Listener interface { - // Close the server. All active sessions will be closed. + // Close the server. All active connections will be closed. Close() error // Addr returns the local network addr that the server is listening on. Addr() net.Addr - // Accept returns new sessions. It should be called in a loop. - Accept(context.Context) (Session, error) + // Accept returns new connections. It should be called in a loop. + Accept(context.Context) (Connection, error) } // An EarlyListener listens for incoming QUIC connections, // and returns them before the handshake completes. type EarlyListener interface { - // Close the server. All active sessions will be closed. + // Close the server. All active connections will be closed. Close() error // Addr returns the local network addr that the server is listening on. Addr() net.Addr - // Accept returns new early sessions. It should be called in a loop. + // Accept returns new early connections. It should be called in a loop. Accept(context.Context) (EarlySession, error) } diff --git a/internal/mocks/quic/early_session.go b/internal/mocks/quic/early_session.go index ef097233..0cb80df0 100644 --- a/internal/mocks/quic/early_session.go +++ b/internal/mocks/quic/early_session.go @@ -138,10 +138,10 @@ func (mr *MockEarlySessionMockRecorder) LocalAddr() *gomock.Call { } // NextSession mocks base method. -func (m *MockEarlySession) NextSession() quic.Session { +func (m *MockEarlySession) NextSession() quic.Connection { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NextSession") - ret0, _ := ret[0].(quic.Session) + ret0, _ := ret[0].(quic.Connection) return ret0 } diff --git a/internal/protocol/params.go b/internal/protocol/params.go index 4bc33e27..1955ccdc 100644 --- a/internal/protocol/params.go +++ b/internal/protocol/params.go @@ -55,7 +55,7 @@ const SkipPacketInitialPeriod PacketNumber = 256 // SkipPacketMaxPeriod is the maximum period length used for packet number skipping. const SkipPacketMaxPeriod PacketNumber = 128 * 1024 -// MaxAcceptQueueSize is the maximum number of sessions that the server queues for accepting. +// MaxAcceptQueueSize is the maximum number of connections that the server queues for accepting. // If the queue is full, new connection attempts will be rejected. const MaxAcceptQueueSize = 32 @@ -112,7 +112,7 @@ const DefaultHandshakeTimeout = 10 * time.Second // It should be shorter than the time that NATs clear their mapping. const MaxKeepAliveInterval = 20 * time.Second -// RetiredConnectionIDDeleteTimeout is the time we keep closed sessions around in order to retransmit the CONNECTION_CLOSE. +// RetiredConnectionIDDeleteTimeout is the time we keep closed connections around in order to retransmit the CONNECTION_CLOSE. // after this time all information about the old connection will be deleted const RetiredConnectionIDDeleteTimeout = 5 * time.Second @@ -189,7 +189,7 @@ const Max0RTTQueueingDuration = 100 * time.Millisecond const Max0RTTQueues = 32 // Max0RTTQueueLen is the maximum number of 0-RTT packets that we buffer for each connection. -// When a new session is created, all buffered packets are passed to the session immediately. +// When a new connection is created, all buffered packets are passed to the connection immediately. // To avoid blocking, this value has to be smaller than MaxSessionUnprocessedPackets. -// To avoid packets being dropped as undecryptable by the session, this value has to be smaller than MaxUndecryptablePackets. +// To avoid packets being dropped as undecryptable by the connection, this value has to be smaller than MaxUndecryptablePackets. const Max0RTTQueueLen = 31 diff --git a/interop/http09/server.go b/interop/http09/server.go index a30e85c7..b51ad48d 100644 --- a/interop/http09/server.go +++ b/interop/http09/server.go @@ -86,7 +86,7 @@ func (s *Server) ListenAndServe() error { } } -func (s *Server) handleConn(sess quic.Session) { +func (s *Server) handleConn(sess quic.Connection) { for { str, err := sess.AcceptStream(context.Background()) if err != nil { diff --git a/logging/types.go b/logging/types.go index e1886503..ad800692 100644 --- a/logging/types.go +++ b/logging/types.go @@ -68,14 +68,14 @@ const ( TimerTypePTO ) -// TimeoutReason is the reason why a session is closed +// TimeoutReason is the reason why a connection is closed type TimeoutReason uint8 const ( - // TimeoutReasonHandshake is used when the session is closed due to a handshake timeout + // TimeoutReasonHandshake is used when the connection is closed due to a handshake timeout // This reason is not defined in the qlog draft, but very useful for debugging. TimeoutReasonHandshake TimeoutReason = iota - // TimeoutReasonIdle is used when the session is closed due to an idle timeout + // TimeoutReasonIdle is used when the connection is closed due to an idle timeout // This reason is not defined in the qlog draft, but very useful for debugging. TimeoutReasonIdle ) @@ -87,7 +87,7 @@ const ( CongestionStateSlowStart CongestionState = iota // CongestionStateCongestionAvoidance is the slow start phase of Reno / Cubic CongestionStateCongestionAvoidance - // CongestionStateCongestionAvoidance is the recovery phase of Reno / Cubic + // CongestionStateRecovery is the recovery phase of Reno / Cubic CongestionStateRecovery // CongestionStateApplicationLimited means that the congestion controller is application limited CongestionStateApplicationLimited diff --git a/mock_quic_session_test.go b/mock_quic_session_test.go index 08c03c30..20167cae 100644 --- a/mock_quic_session_test.go +++ b/mock_quic_session_test.go @@ -151,10 +151,10 @@ func (mr *MockQuicSessionMockRecorder) LocalAddr() *gomock.Call { } // NextSession mocks base method. -func (m *MockQuicSession) NextSession() Session { +func (m *MockQuicSession) NextSession() Connection { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NextSession") - ret0, _ := ret[0].(Session) + ret0, _ := ret[0].(Connection) return ret0 } diff --git a/server.go b/server.go index 6ab869c0..866d506b 100644 --- a/server.go +++ b/server.go @@ -260,7 +260,7 @@ var defaultAcceptToken = func(clientAddr net.Addr, token *Token) bool { // Accept returns sessions that already completed the handshake. // It is only valid if acceptEarlySessions is false. -func (s *baseServer) Accept(ctx context.Context) (Session, error) { +func (s *baseServer) Accept(ctx context.Context) (Connection, error) { return s.accept(ctx) } diff --git a/session.go b/session.go index 4fda6f81..39dd836b 100644 --- a/session.go +++ b/session.go @@ -130,7 +130,7 @@ func (e *errCloseForRecreating) Error() string { var sessionTracingID uint64 // to be accessed atomically func nextSessionTracingID() uint64 { return atomic.AddUint64(&sessionTracingID, 1) } -// A Session is a QUIC session +// A Connection is a QUIC session type session struct { // Destination connection ID used during the handshake. // Used to check source connection ID on incoming packets. @@ -222,7 +222,7 @@ type session struct { } var ( - _ Session = &session{} + _ Connection = &session{} _ EarlySession = &session{} _ streamSender = &session{} deadlineSendImmediately = time.Time{}.Add(42 * time.Millisecond) // any value > time.Time{} and before time.Now() is fine @@ -1996,7 +1996,7 @@ func (s *session) GetVersion() protocol.VersionNumber { return s.version } -func (s *session) NextSession() Session { +func (s *session) NextSession() Connection { <-s.HandshakeComplete().Done() s.streamsMap.UseResetMaps() return s diff --git a/session_test.go b/session_test.go index 531828a0..98d049e2 100644 --- a/session_test.go +++ b/session_test.go @@ -43,7 +43,7 @@ func areClosedSessionsRunning() bool { return strings.Contains(b.String(), "quic-go.(*closedLocalSession).run") } -var _ = Describe("Session", func() { +var _ = Describe("Connection", func() { var ( sess *session sessionRunner *MockSessionRunner @@ -2413,7 +2413,7 @@ var _ = Describe("Session", func() { }) }) -var _ = Describe("Client Session", func() { +var _ = Describe("Client Connection", func() { var ( sess *session sessionRunner *MockSessionRunner