func acceptConnections(in chan net.Conn, listener *net.UnixListener) { for { c, err := listener.Accept() if err != nil { panic(err.String()) } in <- c } }
func connListener(conn chan net.Conn, listener *net.UnixListener) { for { c, err := listener.Accept() if err != nil { panic("Accept: ", err.String()) } conn <- c } }
func (us *UnixSock) Accept(l *net.UnixListener) { // Why doesn't this get called on ctrl + c defer l.Close() for { fd, err := l.Accept() if err != nil { break } us.processBuffer(fd) } }
func listen(sock *net.UnixListener, logChan chan []byte) { defer sock.Close() defer wg.Done() // Timeout after 2 seconds sock.SetDeadline(time.Now().Add((2 * time.Second))) for run { client, err := sock.Accept() if err != nil { ne, ok := err.(net.Error) if !ok || !ne.Temporary() { // Non-temporary (fatal) error log.Printf("Error accepting client:\n%v", err) break } } else { wg.Add(1) go handle(client, logChan) } } }