Accepts a new connection.
354699
private boolean accept(SocketBar socket)
  {
    PortTcp port = port();
    
    try {
      while (! port().isClosed()) {
        // Thread.interrupted();

        if (_serverSocket.accept(socket)) {
          if (port.isClosed()) {
            socket.close();
            return false;
          }
          else if (isThrottle()) {
            socket.close();
          }
          else {
            return true;
          }
        }
      }
    } catch (Throwable e) {
      if (port.isActive() && log.isLoggable(Level.FINER)) {
        log.log(Level.FINER, e.toString(), e);
      }
    }

    return false;
  }
840264
def _accept_loop(self):
        """"""
        self._listening_sock.setblocking(0)
        while not self._stopped and not _shutting_down:
            try:
                # Wait a short time to accept.
                if select.select([self._listening_sock.fileno()], [], [], 1):
                    client, client_addr = self._listening_sock.accept()
                    client.setblocking(True)
                    self._log('connection from %s' % format_addr(client_addr))
                    server_thread = threading.Thread(
                        target=functools.partial(
                            self._server_loop, client, client_addr))

                    # Store weakrefs to the thread and socket, so we can
                    # dispose them in stop().
                    self._server_threads[server_thread] = None
                    self._server_socks[client] = None

                    server_thread.daemon = True
                    server_thread.start()
            except socket.error as error:
                if error.errno not in (
                    errno.EAGAIN, errno.EBADF, errno.EWOULDBLOCK):
                    raise
            except select.error as error:
                if error.args[0] == errno.EBADF:
                    # Closed.
                    break
                else:
                    raise
133395
private void accept(final SelectionKey key) throws IOException {
    final ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel();

    if (serverChannel.isOpen()) {
      final SocketChannel clientChannel = serverChannel.accept();
  
      clientChannel.configureBlocking(false);
  
      final SelectionKey clientChannelKey = clientChannel.register(selector, SelectionKey.OP_READ);
  
      clientChannelKey.attach(new RawMessageBuilder(messageBuffer.capacity()));
    }
  }
62760
def accept(self):
        
        fd, addr = self._accept()
        sock = socket(self.family, self.type, self.proto, fileno=fd)
        # Issue #7995: if no default timeout is set and the listening
        # socket had a (non-zero) timeout, force the new socket in blocking
        # mode to override platform-specific socket flags inheritance.
        if getdefaulttimeout() is None and self.gettimeout():
            sock.setblocking(True)
        return sock, addr
229791
def reconnect(self):
        
        # This is the old connection IOLoop instance, stop its ioloop
        self._connection.ioloop.stop()

        if not self._closing:
            # Create a new connection
            self._connection = self.connect()
            # There is now a new connection, needs a new ioloop to run
            self._connection.ioloop.start()
1341970
def register_incoming_conn(self, conn):
        """"""
        assert conn, "conn is required"
        conn.set_outbound_pending_change_callback(self._on_conn_change)
        self.connections.appendleft(conn)
        self._set_on_close_cb(conn)
        self._on_conn_change()
274265
public void addNewConnective() {

        String fieldName = this.fieldName;
        String fieldType = this.fieldType;
        String factType = this.factType;

        if ( this.connectives == null ) {
            this.connectives = new ConnectiveConstraint[]{ new ConnectiveConstraint( factType,
                                                                                     fieldName,
                                                                                     fieldType ) };
        } else {
            final ConnectiveConstraint[] newList = new ConnectiveConstraint[ this.connectives.length + 1 ];
            for ( int i = 0; i < this.connectives.length; i++ ) {
                newList[ i ] = this.connectives[ i ];
            }
            newList[ this.connectives.length ] = new ConnectiveConstraint( factType,
                                                                           fieldName,
                                                                           fieldType );
            this.connectives = newList;
        }
    }
1019278
public ConversationReceiveListener acceptConnection(Conversation cfConversation) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "acceptConnection", cfConversation);

        // Add this conversation to our active conversations list
        synchronized (activeConversations) {
            Object connectionReference = cfConversation.getConnectionReference();
            ArrayList list = (ArrayList) activeConversations.get(connectionReference);
            if (list == null) {
                list = new ArrayList();
                activeConversations.put(connectionReference, list);
            } else {
                // This is mank - but if TRM does a redirect it is possible that we may get a
                // connection but then they close the Conversation directly without sending us any
                // kind of close flow. As such, every time we connect we should have a check on all
                // the conversations to ensure they are not closed, and if they are remove them from
                // the list.
                ArrayList removeList = new ArrayList();
                for (int x = 0; x < list.size(); x++) {
                    Conversation conv = (Conversation) list.get(x);
                    if (conv.isClosed()) {
                        removeList.add(conv);
                    }
                }

                // Actually do the remove...
                for (int x = 0; x < removeList.size(); x++) {
                    list.remove(removeList.get(x));
                }
            }
            list.add(cfConversation);

            // At this point we have a look to see if the connection closed listener has been set.
            // If it has not been set then this is a new connection (or one with no active
            // Conversations on it. We must set ourselves as the listener in the event that the
            // socket terminates before any SI connections are established and so any cleanup
            // required.
            // Note that once a connection to the ME is established, this listener is overwritten
            // with one in ServerSideConnection. This also performs the same cleanup but also does
            // MFP cleanup as well (which is not appropriate if the connection goes down at this
            // stage).
            if (cfConversation.getConnectionClosedListener(ConversationUsageType.JFAP) == null) {
                cfConversation.addConnectionClosedListener(this, ConversationUsageType.JFAP);
            }
        }

        if (cfConversation.getAttachment() == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Creating conversation state");
            cfConversation.setAttachment(new ConversationState());
        }

        if (cfConversation.getLinkLevelAttachment() == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Creating link level state");
            cfConversation.setLinkLevelAttachment(new ServerLinkLevelState());
        }

        // Set a hint that this conversation is being used for ME to client communications.
        cfConversation.setConversationType(Conversation.CLIENT);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "acceptConnection", serverTransportReceiveListener);
        return serverTransportReceiveListener;
    }
189959
def _new_conn(self):
        
        self.num_connections += 1
        log.info("Starting new HTTPS connection (%d): %s"
                 % (self.num_connections, self.host))

        if not ssl:
            return HTTPSConnection(host=self.host, port=self.port)

        connection = VerifiedHTTPSConnection(host=self.host, port=self.port)
        connection.set_cert(key_file=self.key_file, cert_file=self.cert_file,
                            cert_reqs=self.cert_reqs, ca_certs=self.ca_certs)
        return connection
356668
def new_connection_status(self, conn_status):
        """"""
        if conn_status.status == CONNECTION_STATUS_CONNECTED:
            self._mz.update_members()
        if (conn_status.status == CONNECTION_STATUS_DISCONNECTED or
                conn_status.status == CONNECTION_STATUS_LOST):
            self._mz.reset_members()
343053
def _new_conn(self):
        
        self.num_connections += 1
        log.info("Starting new HTTP connection (%d): %s" %
                 (self.num_connections, self.host))
        return HTTPConnection(host=self.host, port=self.port)
600864
public ConversationReceiveListener acceptConnection(Conversation cfConversation) {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "acceptConnection");

        // Return new instance of a GenericTransportReceiveListener. This listener
        // determines whether data has been received from a client or ME and routes it
        // accordingly to the ServerTransportReceiveListener or MEConnectionListener

        if (tc.isEntryEnabled())
            SibTr.exit(tc, "acceptConnection");

        return genericTransportRecieveListnerInstance; // F193735.3
    }
530055
def new_connection (self):
        
        if self.get('LocalSocket'):
            host = 'localhost'
            sock = self.create_local_socket()
        elif self.get('TCPSocket'):
            host = self.get('TCPAddr', 'localhost')
            sock = self.create_tcp_socket(host)
        else:
            raise ClamavError(_("one of TCPSocket or LocalSocket must be enabled"))
        return sock, host
474678
def register_outgoing_conn(self, conn):
        """"""
        assert conn, "conn is required"
        conn.set_outbound_pending_change_callback(self._on_conn_change)
        self.connections.append(conn)
        self._set_on_close_cb(conn)
        self._on_conn_change()
224085
def on_connect(self, connection):
        ""
        self._stream = connection._reader
        self._buffer = SocketBuffer(self._stream, self._read_size)
        if connection.decode_responses:
            self.encoding = connection.encoding
831890
public function accept()
    {
        $res = @socket_accept($this->socket);
        if ($res === false) {
            $this->throwSocketError();
        }

        return new Socket($res);
    }
673557
def make_connection(self):
        ""
        connection = self.connection_class(**self.connection_kwargs)
        self._connections.append(connection)
        return connection