// accept the rerouting proposal
760180
func refuseRerouting(peer *Peer, messageId uint64, reason string) error {
	message := Message{}
	err := message.
		setCommand(CMD_RP_NAK).
		setContact(Me()).
		setReason(reason).
		send(peer)
	if err != nil {
		Logln("Rerouting refusal failed", err)
		return err
	}
	peer.
		SetState(STATE_STANDBY).
		SetReason(reason)
	Logln("Rerouting refusal sent.")
	return nil
}
1277777
func (l TCPKeepAliveListener) Accept() (c net.Conn, err error) {
	tc, err := l.AcceptTCP()
	if err != nil {
		return
	}
	tc.SetKeepAlive(true)
	tc.SetKeepAlivePeriod(keepAlivePeriod)
	return tc, nil
}
1054550
func (t *T) Accept() (net.Conn, error) {
	c, err := t.l.Accept()
	if err != nil {
		return nil, err
	}

	connID := atomic.AddUint64(&t.connCount, 1)
	shard := &t.shards[int(connID)%len(t.shards)]
	wc := &conn{
		Conn:  c,
		shard: shard,
		mode:  t.mode,
	}

	if err = wc.init(); err != nil {
		return nil, err
	}
	return wc, nil
}
1129287
func (l *i2pListener) Accept() (c net.Conn, err error) {
	if l.session == nil {
		err = errors.New("session closed")
		return
	}
	var nc net.Conn
	nc, err = l.session.OpenControlSocket()
	if err == nil {
		_, err = fmt.Fprintf(nc, "STREAM ACCEPT ID=%s SILENT=false\n", l.session.Name())
		if err == nil {
			r := bufio.NewReader(nc)
			var line string
			// read response line
			line, err = r.ReadString(10)
			if err == nil {
				sc := bufio.NewScanner(strings.NewReader(line))
				sc.Split(bufio.ScanWords)
				for sc.Scan() {
					text := sc.Text()
					upper := strings.ToUpper(text)
					if upper == "STREAM" {
						continue
					}
					if upper == "RESULT" {
						continue
					}
					if upper == "RESULT=OK" {
						// we good
						break
					}
					// error
					err = errors.New(text)
				}
			}
			// read address line
			line, err = r.ReadString(10)
			if err == nil {
				// we got a new connection yeeeeh
				c = &I2PConn{
					c:     nc,
					laddr: l.laddr,
					raddr: I2PAddr(line[:len(line)-1]),
				}
			}
		}
		if c == nil {
			// we didn't get a connection
			nc.Close()
		}
	}
	return
}
523558
func (l ProxiedListener) Accept() (c net.Conn, err error) {
	nc, err := l.netListener.Accept()
	if err != nil {
		return nil, err
	}

	tcpConn, ok := nc.(*net.TCPConn)
	if !ok {
		zap.L().Error("Received a non-TCP connection - this should never happen", zap.Error(err))
		return nil, fmt.Errorf("Not a tcp connection - ignoring")
	}

	ip, port, err := GetOriginalDestination(tcpConn)
	if err != nil {
		zap.L().Error("Failed to discover original destination - aborting", zap.Error(err))
		return nil, err
	}

	return &ProxiedConnection{
		originalIP:            ip,
		originalPort:          port,
		originalTCPConnection: tcpConn,
	}, nil
}
52426
func Accept(ops ...AcceptOpt) *scheduler.Call {
	ab := &acceptBuilder{
		offerIDs: make(map[mesos.OfferID]struct{}, len(ops)),
	}
	for _, op := range ops {
		op(ab)
	}
	offerIDs := make([]mesos.OfferID, 0, len(ab.offerIDs))
	for id := range ab.offerIDs {
		offerIDs = append(offerIDs, id)
	}
	return &scheduler.Call{
		Type: scheduler.Call_ACCEPT,
		Accept: &scheduler.Call_Accept{
			OfferIDs:   offerIDs,
			Operations: ab.operations,
		},
	}
}
1160846
func (n *ExplainStmt) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*ExplainStmt)
	node, ok := n.Stmt.Accept(v)
	if !ok {
		return n, false
	}
	n.Stmt = node.(DMLNode)
	return v.Leave(n)
}
264722
func (s *Socket) Accept() (net.Conn, error) {
	mu.Lock()
	defer mu.Unlock()
	for {
		syn, err := s.nextSyn()
		if err != nil {
			return nil, err
		}
		c, ok := s.ackSyn(syn)
		if ok {
			c.updateCanWrite()
			return c, nil
		}
	}
}
80487
func (p *ProtoListener) Accept() (net.Conn, error) {
	c, ok := <-p.connection
	if !ok {
		return nil, fmt.Errorf("mux: listener closed")
	}
	return c, nil
}
4948
func (l *maListener) Accept() (Conn, error) {
	nconn, err := l.Listener.Accept()
	if err != nil {
		return nil, err
	}

	var raddr ma.Multiaddr
	// This block protects us in transports (i.e. unix sockets) that don't have
	// remote addresses for inbound connections.
	if nconn.RemoteAddr().String() != "" {
		raddr, err = FromNetAddr(nconn.RemoteAddr())
		if err != nil {
			return nil, fmt.Errorf("failed to convert conn.RemoteAddr: %s", err)
		}
	}

	return wrap(nconn, l.laddr, raddr), nil
}
976151
func (s *acceptFirst) Accept(from interface{}) bool {
	if _, ok := s.handled[from]; ok {
		return false
	}
	s.handled[from] = struct{}{}
	return true
}
1252890
func (s *Session) Accept() (net.Conn, error) {
	conn, err := s.AcceptStream()
	if err != nil {
		return nil, err
	}
	return conn, err
}
1207231
func (l *TCPListener) Accept() (c net.Conn, err error) {
	conn, err := l.AcceptTCP()
	if err != nil {
		return
	}

	// TODO(brutella) Check if we should use tcp keepalive
	// conn.SetKeepAlive(true)
	// conn.SetKeepAlivePeriod(3 * time.Minute)
	hapConn := NewConnection(conn, l.context)

	return hapConn, err
}
468880
func (l *Listener) Accept() (net.Conn, error) {
	conn, err := l.listener.Accept()
	if err != nil {
		if l.isClosed() {
			err = fmt.Errorf("listener already closed: err=(%s)", err)
		}
		return nil, err
	}
	return conn, nil
}
244555
func (n *negotiator) Accepts(ctype string) float64 {
	return accepts(n.r.Header.Get("Accept"), ctype)
}
189507
func (b *Filter) Accept(peer fab.Peer) bool {
	peerAddress := endpoint.ToAddress(peer.URL())
	value, ok := b.greylistURLs.Load(peerAddress)
	if ok {
		timeAdded, ok := value.(time.Time)
		if ok && timeAdded.Add(b.expiryInterval).After(time.Now()) {
			logger.Infof("Rejecting peer %s", peer.URL())
			return false
		}
		b.greylistURLs.Delete(peerAddress)
	}

	return true
}
619407
func (e *Engine) Accept(server transport.Server) {
	e.tomb.Go(func() error {
		for {
			// return if dying
			if !e.tomb.Alive() {
				return tomb.ErrDying
			}

			// accept next connection
			conn, err := server.Accept()
			if err != nil {
				// call error callback if available
				if e.OnError != nil {
					e.OnError(err)
				}

				return err
			}

			// handle connection
			if !e.Handle(conn) {
				return nil
			}
		}
	})
}