@ -798,7 +798,7 @@ func (s *Server) Stop() {
|
|||||||
func (s *Server) GracefulStop() {
|
func (s *Server) GracefulStop() {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
if s.drain == true || s.conns == nil {
|
if s.drain == true || s.conns == nil {
|
||||||
s.mu.Lock()
|
s.mu.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.drain = true
|
s.drain = true
|
||||||
|
@ -553,6 +553,27 @@ func testTimeoutOnDeadServer(t *testing.T, e env) {
|
|||||||
awaitNewConnLogOutput()
|
awaitNewConnLogOutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServerGracefulStopIdempotent(t *testing.T) {
|
||||||
|
defer leakCheck(t)()
|
||||||
|
for _, e := range listTestEnv() {
|
||||||
|
if e.name == "handler-tls" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
testServerGracefulStopIdempotent(t, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testServerGracefulStopIdempotent(t *testing.T, e env) {
|
||||||
|
te := newTest(t, e)
|
||||||
|
te.userAgent = testAppUA
|
||||||
|
te.startServer(&testServer{security: e.security})
|
||||||
|
defer te.tearDown()
|
||||||
|
|
||||||
|
for i := 0; i < 3; i++ {
|
||||||
|
te.srv.GracefulStop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestServerGoAway(t *testing.T) {
|
func TestServerGoAway(t *testing.T) {
|
||||||
defer leakCheck(t)()
|
defer leakCheck(t)()
|
||||||
for _, e := range listTestEnv() {
|
for _, e := range listTestEnv() {
|
||||||
|
Reference in New Issue
Block a user