func (n *NSQAdmin) Main() {
httpListener, err := net.Listen("tcp", n.httpAddr.String())
if err != nil {
n.logf("FATAL: listen (%s) failed - %s", n.httpAddr, err)
os.Exit(1)
}
n.httpListener = httpListener
httpServer := NewHTTPServer(&Context{n})
n.waitGroup.Wrap(func() {
util.HTTPServer(n.httpListener, httpServer, n.opts.Logger, "HTTP")
})
n.waitGroup.Wrap(func() { n.handleAdminActions() })
}
func (n *NSQAdmin) Exit() {
n.httpListener.Close()
close(n.notifications)
n.waitGroup.Wait()
}