func (l *NSQLookupd) Main() { tcpListener, err := net.Listen("tcp", l.tcpAddr.String()) if err != nil { log.Fatalf("FATAL: listen (%s) failed - %s", l.tcpAddr, err.Error()) } l.tcpListener = tcpListener l.waitGroup.Wrap(func() { util.TcpServer(tcpListener, &TcpProtocol{protocols: protocols}) }) httpListener, err := net.Listen("tcp", l.httpAddr.String()) if err != nil { log.Fatalf("FATAL: listen (%s) failed - %s", l.httpAddr, err.Error()) } l.httpListener = httpListener l.waitGroup.Wrap(func() { httpServer(httpListener) }) }
func (n *NSQd) Main() { n.waitGroup.Wrap(func() { n.lookupLoop() }) tcpListener, err := net.Listen("tcp", n.tcpAddr.String()) if err != nil { log.Fatalf("FATAL: listen (%s) failed - %s", n.tcpAddr, err.Error()) } n.tcpListener = tcpListener n.waitGroup.Wrap(func() { util.TcpServer(n.tcpListener, &TcpProtocol{protocols: protocols}) }) httpListener, err := net.Listen("tcp", n.httpAddr.String()) if err != nil { log.Fatalf("FATAL: listen (%s) failed - %s", n.httpAddr, err.Error()) } n.httpListener = httpListener n.waitGroup.Wrap(func() { httpServer(n.httpListener) }) }