server: ensure that we also shutdown network segment serf instances on server shutdown (#8786)

This really only matters for unit tests, since typically if an agent shuts down its server, it follows that up by exiting the process, which would also clean up all of the networking anyway.
This commit is contained in:
R.B. Boyer 2020-09-30 16:23:43 -05:00 committed by GitHub
parent e138a6499c
commit 237a7a0da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

3
.changelog/8786.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
server: **(Consul Enterprise only)** ensure that we also shutdown network segment serf instances on server shutdown
```

View File

@ -914,6 +914,10 @@ func (s *Server) Shutdown() error {
s.serfLAN.Shutdown() s.serfLAN.Shutdown()
} }
for _, segment := range s.segmentLAN {
segment.Shutdown()
}
if s.serfWAN != nil { if s.serfWAN != nil {
s.serfWAN.Shutdown() s.serfWAN.Shutdown()
if err := s.router.RemoveArea(types.AreaWAN); err != nil { if err := s.router.RemoveArea(types.AreaWAN); err != nil {