mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 21:27:35 +03:00
split the Session.Close(error) in Close() and CloseWithError(error)
This commit is contained in:
parent
2bc5b7f532
commit
8b2992a243
22 changed files with 168 additions and 105 deletions
|
@ -86,7 +86,7 @@ var _ = Describe("Client", func() {
|
|||
|
||||
AfterEach(func() {
|
||||
if s, ok := cl.session.(*session); ok {
|
||||
s.Close(nil)
|
||||
s.Close()
|
||||
}
|
||||
Eventually(areSessionsRunning).Should(BeFalse())
|
||||
})
|
||||
|
@ -254,7 +254,7 @@ var _ = Describe("Client", func() {
|
|||
close(dialed)
|
||||
}()
|
||||
Consistently(dialed).ShouldNot(BeClosed())
|
||||
sess.EXPECT().Close(nil)
|
||||
sess.EXPECT().Close()
|
||||
cancel()
|
||||
Eventually(dialed).Should(BeClosed())
|
||||
})
|
||||
|
@ -493,7 +493,7 @@ var _ = Describe("Client", func() {
|
|||
sess1 := NewMockQuicSession(mockCtrl)
|
||||
run1 := make(chan struct{})
|
||||
sess1.EXPECT().run().Do(func() { <-run1 }).Return(errCloseSessionForNewVersion)
|
||||
sess1.EXPECT().Close(errCloseSessionForNewVersion).Do(func(error) { close(run1) })
|
||||
sess1.EXPECT().destroy(errCloseSessionForNewVersion).Do(func(error) { close(run1) })
|
||||
sess2 := NewMockQuicSession(mockCtrl)
|
||||
sess2.EXPECT().run()
|
||||
sessionChan := make(chan *MockQuicSession, 2)
|
||||
|
@ -538,7 +538,7 @@ var _ = Describe("Client", func() {
|
|||
sess1 := NewMockQuicSession(mockCtrl)
|
||||
run1 := make(chan struct{})
|
||||
sess1.EXPECT().run().Do(func() { <-run1 }).Return(errCloseSessionForNewVersion)
|
||||
sess1.EXPECT().Close(errCloseSessionForNewVersion).Do(func(error) { close(run1) })
|
||||
sess1.EXPECT().destroy(errCloseSessionForNewVersion).Do(func(error) { close(run1) })
|
||||
sess2 := NewMockQuicSession(mockCtrl)
|
||||
sess2.EXPECT().run()
|
||||
sessionChan := make(chan *MockQuicSession, 2)
|
||||
|
@ -578,7 +578,7 @@ var _ = Describe("Client", func() {
|
|||
|
||||
It("errors if no matching version is found", func() {
|
||||
sess := NewMockQuicSession(mockCtrl)
|
||||
sess.EXPECT().Close(gomock.Any())
|
||||
sess.EXPECT().destroy(qerr.InvalidVersion)
|
||||
cl.session = sess
|
||||
cl.config = &Config{Versions: protocol.SupportedVersions}
|
||||
cl.handlePacket(composeVersionNegotiationPacket(connID, []protocol.VersionNumber{1}))
|
||||
|
@ -586,7 +586,7 @@ var _ = Describe("Client", func() {
|
|||
|
||||
It("errors if the version is supported by quic-go, but disabled by the quic.Config", func() {
|
||||
sess := NewMockQuicSession(mockCtrl)
|
||||
sess.EXPECT().Close(gomock.Any())
|
||||
sess.EXPECT().destroy(qerr.InvalidVersion)
|
||||
cl.session = sess
|
||||
v := protocol.VersionNumber(1234)
|
||||
Expect(v).ToNot(Equal(cl.version))
|
||||
|
@ -597,7 +597,7 @@ var _ = Describe("Client", func() {
|
|||
It("changes to the version preferred by the quic.Config", func() {
|
||||
mockMultiplexer.EXPECT().AddHandler(gomock.Any(), gomock.Any(), gomock.Any())
|
||||
sess := NewMockQuicSession(mockCtrl)
|
||||
sess.EXPECT().Close(errCloseSessionForNewVersion)
|
||||
sess.EXPECT().destroy(errCloseSessionForNewVersion)
|
||||
cl.session = sess
|
||||
versions := []protocol.VersionNumber{1234, 4321}
|
||||
cl.config = &Config{Versions: versions}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue