// AddListener mocks base method
184985
func (m *MockServiceDiscovery) AddListener(listener cluster.SDListener) {
	m.ctrl.Call(m, "AddListener", listener)
}
939643
func NewListenerWith(logger *events.Logger, listener net.Listener) net.Listener {
	return &listenerLogger{
		Listener: listener,
		Logger:   logger,
	}
}
338262
func (cb *Breaker) AddListener(listener chan ListenerEvent) {
	cb.listeners = append(cb.listeners, listener)
}
624400
func NewListener(l net.Listener, pkfile, certfile string) (net.Listener, error) {
	return NewListenerAddr(l, l.Addr().String(), pkfile, certfile)
}
1367135
func (b *Listeners) Add(f func()) {
	if b == nil {
		return
	}
	b.Lock()
	defer b.Unlock()
	b.listeners = append(b.listeners, f)
}
1106952
func (s *Server) NewListener() (net.Listener, error) {
	addr := net.JoinHostPort(s.Host, strconv.Itoa(s.Port))
	if !s.useTLS() {
		listener, err := net.Listen("tcp", addr)
		if err != nil {
			return nil, err
		}
		return listener, nil
	}

	// If no key specified, therefore, we assume it is in the cert
	if s.Key == "" {
		s.Key = s.Cert
	}

	cert, err := tls.LoadX509KeyPair(string(s.Cert), string(s.Key))
	if err != nil {
		return nil, err
	}

	listener, err := tls.Listen("tcp", addr, &tls.Config{
		Certificates: []tls.Certificate{cert},
	})

	if err != nil {
		return nil, err
	}
	return listener, nil
}
560769
func (r *ListenerRegistry) Add(key interface{}, listener func()) {
	if key == nil {
		key = new(int)
	}
	if _, ok := r.listeners[key]; ok {
		panic("duplicate listener key")
	}
	r.listeners[key] = listener
}
1102007
func createListener() (eventListener, error) {
	listener := &netlinkListener{}
	err := listener.bind()
	return listener, err
}
30512
func NewListener(listener net.Listener) net.Listener {
	return NewListenerWith(events.DefaultLogger, listener)
}
1142973
func (r *marathonClient) AddEventsListener(filter int) (EventsChannel, error) {
	r.Lock()
	defer r.Unlock()

	// step: someone has asked to start listening to event, we need to register for events
	// if we haven't done so already
	if err := r.registerSubscription(); err != nil {
		return nil, err
	}

	channel := make(EventsChannel)
	r.listeners[channel] = EventsChannelContext{
		filter:     filter,
		done:       make(chan struct{}, 1),
		completion: &sync.WaitGroup{},
	}
	return channel, nil
}
487581
func (s *DescribeListenerOutput) SetListener(v *Listener) *DescribeListenerOutput {
	s.Listener = v
	return s
}
211751
func (s *Server) ServeListener(l net.Listener) error {
	for {
		conn, err := l.Accept()
		if netutil.IsTemporaryError(err) {
			log.Warn("RPC accept error", "err", err)
			continue
		} else if err != nil {
			return err
		}
		log.Trace("Accepted RPC connection", "conn", conn.RemoteAddr())
		go s.ServeCodec(NewJSONCodec(conn), OptionMethodInvocation|OptionSubscriptions)
	}
}
470145
func (p *Loader) GetListener() (id string, ch chan PaymentStatusUpdate, err error) {
	ch = make(chan PaymentStatusUpdate, 100)
	id, err = libkb.RandString("", 8)
	if err != nil {
		return id, ch, err
	}
	p.Lock()
	p.listeners[id] = ch
	p.Unlock()

	return id, ch, nil
}
1323155
func (s *Server) WrapListener(ln net.Listener) net.Listener {
	if ln == nil {
		return nil
	}
	cln := ln.(caddy.Listener)
	for _, site := range s.sites {
		for _, m := range site.listenerMiddleware {
			cln = m(cln)
		}
	}
	return cln
}
801238
func (m *MockGauge) Add(arg0 float64) {
	m.ctrl.Call(m, "Add", arg0)
}
494447
func WithListener(l net.Listener) JSONSourceOption {
	return func(j *JSONSource) {
		j.listener = l
		j.addr = l.Addr().String()
	}
}
213504
func (s *ProxyServer) ServeOnListener(l net.Listener) error {
	server := http.Server{
		Handler: s.handler,
	}
	return server.Serve(l)
}