()
| 370 | } |
| 371 | |
| 372 | func (s *Proxy) serveAdmin() { |
| 373 | if s.IsClosed() { |
| 374 | return |
| 375 | } |
| 376 | defer s.Close() |
| 377 | |
| 378 | log.Warnf("[%p] admin start service on %s", s, s.ladmin.Addr()) |
| 379 | |
| 380 | eh := make(chan error, 1) |
| 381 | go func(l net.Listener) { |
| 382 | h := http.NewServeMux() |
| 383 | h.Handle("/", newApiServer(s)) |
| 384 | hs := &http.Server{Handler: h} |
| 385 | eh <- hs.Serve(l) |
| 386 | }(s.ladmin) |
| 387 | |
| 388 | select { |
| 389 | case <-s.exit.C: |
| 390 | log.Warnf("[%p] admin shutdown", s) |
| 391 | case err := <-eh: |
| 392 | log.ErrorErrorf(err, "[%p] admin exit on error", s) |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | func (s *Proxy) serveProxy() { |
| 397 | if s.IsClosed() { |
no test coverage detected