// Listen implements the PipeListener Listen method.
498947
func (l *listener) Listen() error {
	listener, err := winio.ListenPipe("\\\\.\\pipe\\"+l.path, &l.config)
	if err != nil {
		return err
	}
	l.listener = listener
	return nil
}
768207
func (p *Progress) Listen() {
	for {

		p.mtx.Lock()
		interval := p.RefreshInterval
		p.mtx.Unlock()

		select {
		case <-time.After(interval):
			p.print()
		case <-p.tdone:
			p.print()
			close(p.tdone)
			return
		}
	}
}
130595
func Listen(network, address string) (net.Listener, error) {
	if network == "unix" {
		return winio.ListenPipe(address, nil)
	}
	return net.Listen(network, address)
}
1337881
func Listen(addr string, c chan Packet) {
	laddr, err := net.ResolveUDPAddr("udp", addr)
	if err != nil {
		log.Fatalln("fatal: failed to resolve address", err)
	}
	conn, err := net.ListenUDP("udp", laddr)
	if err != nil {
		log.Fatalln("fatal: failed to listen", err)
	}
	for {
		buf := make([]byte, 1452)
		n, err := conn.Read(buf[:])
		if err != nil {
			log.Println("error: Failed to recieve packet", err)
		} else {
			packets, err := Parse(buf[0:n])
			if err != nil {
				log.Println("error: Failed to recieve packet", err)
			}
			for _, p := range *packets {
				c <- p
			}
		}
	}
}
660999
func (mm *MessageManager) Listen(messageType string, handler MessageHandler) MessageHandlerId {
	mm.Lock()
	defer mm.Unlock()
	if mm.listeners == nil {
		mm.listeners = make(map[string][]HandlerIDPair)
	}
	handlerID := getNewHandlerID()
	newHandlerIDPair := HandlerIDPair{MessageHandlerId: handlerID, MessageHandler: handler}
	mm.listeners[messageType] = append(mm.listeners[messageType], newHandlerIDPair)
	return handlerID
}
805374
func (queue *AMQP) Listen(fn dispatch.Listenner) error {
	conn, err := amqp.Dial(queue.host)
	if err != nil {
		return err
	}
	defer conn.Close()

	ch, err := conn.Channel()
	if err != nil {
		return err
	}
	defer ch.Close()

	err = ch.Qos(
		1,     // prefetch count
		0,     // prefetch size
		false, // global
	)
	if err != nil {
		return err
	}

	msgs, err := ch.Consume(
		queue.Name, // queue
		"",         // consumer
		false,      // auto-ack
		false,      // exclusive
		false,      // no-local
		false,      // no-wait
		nil,        // args
	)
	if err != nil {
		return err
	}
	errChan := make(chan error)

	go func() {
		for d := range msgs {
			if err := fn(d.Body); err != nil {
				defer d.Reject(true)
				errChan <- err
				return
			}
			d.Ack(false)
		}
	}()

	return <-errChan
}
846630
func (s *Server) Listen() error {
	ln, err := net.Listen("tcp", "0.0.0.0:"+strconv.Itoa(s.Port))
	if err != nil {
		return err
	}
	s.netListener = ln
	addr := ln.Addr().(*net.TCPAddr)
	if s.Port == 0 {
		s.Port = addr.Port
	}

	go s.listenHTTP(addr)
	s.Printf("Listening: 0.0.0.0:%d, ip: %s", s.Port, s.IP)
	s.listeningWG.Done()
	for {
		conn, err := ln.Accept()
		if err != nil {
			return err
		}
		s.Printf("New connection from %s", conn.RemoteAddr())
		go s.handleConnection(s.NewConn(conn))
	}
}
919236
func (s *Swarm) Listen(addrs ...ma.Multiaddr) error {
	errs := make([]error, len(addrs))
	var succeeded int
	for i, a := range addrs {
		if err := s.AddListenAddr(a); err != nil {
			errs[i] = err
		} else {
			succeeded++
		}
	}

	for i, e := range errs {
		if e != nil {
			log.Warningf("listen on %s failed: %s", addrs[i], errs[i])
		}
	}

	if succeeded == 0 && len(addrs) > 0 {
		return fmt.Errorf("failed to listen on any addresses: %s", errs)
	}

	return nil
}
652568
func (a *Addr) Listen() (net.Listener, error) {
	// Start the listener now, if there's a default
	// and nothing's called Set yet.
	if a.err == nil && a.ln == nil && a.s != "" {
		if err := a.Set(a.s); err != nil {
			return nil, err
		}
	}
	if a.err != nil {
		return nil, a.err
	}
	if a.ln != nil {
		return a.ln, nil
	}
	return nil, errors.New("listen: no error or listener")
}
1276255
func (s *Server) Listen(address string, port int) (net.Listener, error) {
	return net.Listen("tcp", fmt.Sprintf("%s:%d", address, port))
}
1179939
func (h *EventHandler) Listen(match func(eh.Event) bool) *EventListener {
	l := &EventListener{
		id:         uuid.New(),
		inbox:      make(chan eh.Event, 1),
		match:      match,
		unregister: h.unregister,
	}
	// Register us to the in-flight listeners.
	h.register <- l

	return l
}
443420
func (c *ChannelStream) Listen(m Reactor) {
	if atomic.LoadInt64(&c.closed) > 0 {
		return
	}

	m.React(func(m Reactor, err error, data interface{}) {
		if err != nil {
			c.error(err)
			m.ReplyError(err)
			return
		}
		c.data(data)
		m.Reply(err)
	}, true)
}
503251
func (s *Server) Listen() (net.Listener, error) {
	l, err := net.Listen("tcp", s.Addr[len(TransportDNS+"://"):])
	if err != nil {
		return nil, err
	}
	return l, nil
}
839168
func Listen(network, addr string, listening chan bool) {
	ln, err := net.Listen(network, addr)
	if err != nil {
		log.Fatalf("Listen failed: %v\n", err)
		os.Exit(1)
	}
	s := newServer()
	go s.broadcastIdleEvents()
	listening <- true
	for {
		conn, err := ln.Accept()
		if err != nil {
			log.Printf("Accept failed: %v\n", err)
			continue
		}
		go s.handleConnection(textproto.NewConn(conn))
	}
}
1200129
func (c *RPCClient) listen() {
	defer c.Close()
	var respHeader responseHeader
	for {
		if err := c.dec.Decode(&respHeader); err != nil {
			if !c.shutdown {
				log.Printf("[ERR] agent.client: Failed to decode response header: %v", err)
			}
			break
		}
		c.respondSeq(respHeader.Seq, &respHeader)
	}
}
472153
func (s *Server) Listen(addr string) error {
	return http.ListenAndServe(addr, s)
}
699161
func Listen(c chan<- Operation) {
	dummy.mu.Lock()
	defer dummy.mu.Unlock()
	if c == nil {
		c = discardOperations
	}
	dummy.ops = c
	for _, st := range dummy.state {
		st.mu.Lock()
		st.ops = c
		st.mu.Unlock()
	}
}