forked from quic-go/quic-go
use application-specific CONNECTION_CLOSE for normal termination
This commit is contained in:
@@ -1030,7 +1030,7 @@ func (s *session) CloseWithError(code protocol.ApplicationErrorCode, desc string
|
||||
|
||||
func (s *session) handleCloseError(closeErr closeError) {
|
||||
if closeErr.err == nil {
|
||||
closeErr.err = qerr.NoError
|
||||
closeErr.err = qerr.ApplicationError(0, "")
|
||||
}
|
||||
|
||||
var quicErr *qerr.QuicError
|
||||
|
||||
@@ -426,10 +426,16 @@ var _ = Describe("Session", func() {
|
||||
})
|
||||
|
||||
It("shuts down without error", func() {
|
||||
streamManager.EXPECT().CloseWithError(qerr.Error(qerr.NoError, ""))
|
||||
streamManager.EXPECT().CloseWithError(qerr.ApplicationError(0, ""))
|
||||
expectReplaceWithClosed()
|
||||
cryptoSetup.EXPECT().Close()
|
||||
packer.EXPECT().PackConnectionClose(gomock.Any()).Return(&packedPacket{raw: []byte("connection close")}, nil)
|
||||
packer.EXPECT().PackConnectionClose(gomock.Any()).DoAndReturn(func(f *wire.ConnectionCloseFrame) (*packedPacket, error) {
|
||||
Expect(f.IsApplicationError).To(BeTrue())
|
||||
Expect(f.ErrorCode).To(Equal(qerr.NoError))
|
||||
Expect(f.FrameType).To(BeZero())
|
||||
Expect(f.ReasonPhrase).To(BeEmpty())
|
||||
return &packedPacket{raw: []byte("connection close")}, nil
|
||||
})
|
||||
Expect(sess.Close()).To(Succeed())
|
||||
Eventually(areSessionsRunning).Should(BeFalse())
|
||||
Expect(mconn.written).To(HaveLen(1))
|
||||
@@ -438,7 +444,7 @@ var _ = Describe("Session", func() {
|
||||
})
|
||||
|
||||
It("only closes once", func() {
|
||||
streamManager.EXPECT().CloseWithError(qerr.Error(qerr.NoError, ""))
|
||||
streamManager.EXPECT().CloseWithError(gomock.Any())
|
||||
expectReplaceWithClosed()
|
||||
cryptoSetup.EXPECT().Close()
|
||||
packer.EXPECT().PackConnectionClose(gomock.Any()).Return(&packedPacket{}, nil)
|
||||
|
||||
Reference in New Issue
Block a user