forked from quic-go/quic-go
http3: return http.ErrServerClosed for ServeQUICConn after Server.Close (#5095)
This commit is contained in:
@@ -264,6 +264,11 @@ func (s *Server) decreaseConnCount() {
|
|||||||
// ServeQUICConn serves a single QUIC connection.
|
// ServeQUICConn serves a single QUIC connection.
|
||||||
func (s *Server) ServeQUICConn(conn quic.Connection) error {
|
func (s *Server) ServeQUICConn(conn quic.Connection) error {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
|
if s.closed {
|
||||||
|
s.mutex.Unlock()
|
||||||
|
return http.ErrServerClosed
|
||||||
|
}
|
||||||
|
|
||||||
s.init()
|
s.init()
|
||||||
s.mutex.Unlock()
|
s.mutex.Unlock()
|
||||||
|
|
||||||
|
|||||||
@@ -883,6 +883,7 @@ var _ = Describe("Server", func() {
|
|||||||
serv := &Server{}
|
serv := &Server{}
|
||||||
Expect(serv.Close()).To(Succeed())
|
Expect(serv.Close()).To(Succeed())
|
||||||
Expect(serv.ListenAndServeTLS(testdata.GetCertificatePaths())).To(MatchError(http.ErrServerClosed))
|
Expect(serv.ListenAndServeTLS(testdata.GetCertificatePaths())).To(MatchError(http.ErrServerClosed))
|
||||||
|
Expect(serv.ServeQUICConn(nil)).To(MatchError(http.ErrServerClosed))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("handles concurrent Serve and Close", func() {
|
It("handles concurrent Serve and Close", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user