| 302 | } |
| 303 | |
| 304 | func (sc *ServerContext) stopHTTPServers(ctx context.Context) { |
| 305 | sc._httpServersLock.Lock() |
| 306 | defer sc._httpServersLock.Unlock() |
| 307 | for _, s := range sc._httpServers { |
| 308 | if s.server != nil { |
| 309 | base.InfofCtx(ctx, base.KeyHTTP, "Closing HTTP Server: %v", s.addr) |
| 310 | if err := s.server.Close(); err != nil { |
| 311 | base.WarnfCtx(ctx, "Error closing HTTP server %q: %v", s.addr, err) |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | sc._httpServers = nil |
| 316 | } |
| 317 | |
| 318 | // GetDatabase attempts to return the DatabaseContext of the database. It will load the database if necessary. |
| 319 | func (sc *ServerContext) GetDatabase(ctx context.Context, name string) (*db.DatabaseContext, error) { |