Starts the connection process, as called (internally)
        from the user context, either from auto_connect() or connect().
        Never call this from the _comm() process context.
323782
def _start_connect(self, connect_type):
        
        if self._connect_state.value != self.CS_NOT_CONNECTED:
            # already done or in process, assume success
            return

        self._connected.value = 0
        self._connect_state.value = self.CS_ATTEMPTING_CONNECT
        # tell comm process to attempt connection
        self._attempting_connect.value = connect_type

        # EXTREMELY IMPORTANT - for this to work at all in Windows,
        # where the above processes are spawned (vs forked in Unix),
        # the thread objects (as sattributes of this object) must be
        # assigned to this object AFTER we have spawned the processes.
        # That way, multiprocessing can pickle the freshroastsr700
        # successfully. (It can't pickle thread-related stuff.)
        if self.update_data_func is not None:
            # Need to launch the thread that will listen to the event
            self._create_update_data_system(
                None, setFunc=False, createThread=True)
            self.update_data_thread.start()
        if self.state_transition_func is not None:
            # Need to launch the thread that will listen to the event
            self._create_state_transition_system(
                None, setFunc=False, createThread=True)
            self.state_transition_thread.start()
246017
public void start()
    {
        Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Already started");

        client.getConnectionStateListenable().addListener(connectionStateListener);
        createNode();
    }
49885
def start_server(self):
        
        self._stopped.clear()
        if not self._connection or self._connection.is_closed:
            self._create_connection()
        while not self._stopped.is_set():
            try:
                # Check our connection for errors.
                self._connection.check_for_errors()
                self._update_consumers()
            except amqpstorm.AMQPError as why:
                # If an error occurs, re-connect and let update_consumers
                # re-open the channels.
                LOGGER.warning(why)
                self._stop_consumers()
                self._create_connection()
            time.sleep(1)
730962
def init_process(self) -> None:
        
        default_loop = asyncio.get_event_loop()
        if default_loop.is_running():
            default_loop.close()
            self.loop = asyncio.new_event_loop()
            asyncio.set_event_loop(self.loop)
        else:
            self.loop = default_loop
        super().init_process()
909642
public void start() {
        synchronized (LOCK) {
            if (!this.active) {
                this.active = true;
                logger.info("Starting UDP Manager");
                try {
                    generateTasks();
                    logger.info("Initialized UDP interface[" + inet + "]: bind address=" + bindAddress);
                } catch (IOException e) {
                    logger.error("An error occurred while initializing the polling tasks", e);
                    stop();
                }
            }
        }
    }
302763
def start(**kwargs: Any) -> None:
    
    start_server(**kwargs)
    try:
        asyncio.get_event_loop().run_forever()
    except KeyboardInterrupt:
        stop_server()
1063730
def _spawn_redis_connection_thread(self):
        """"""
        self.logger.debug("Spawn redis connection thread")
        self.redis_connected = False
        self._redis_thread = Thread(target=self._setup_redis)
        self._redis_thread.setDaemon(True)
        self._redis_thread.start()
1216966
private boolean startConnection()
  {
    long now = getCurrentTimeActual();

    updateIdleExpireTime(now);

    int id = _gId.incrementAndGet();

    _launcher.launchChildThread(id);
        
    return true;
  }
27110
def start_connect(self):
        
        if self._start_connect is not None:
            raise TimeoutStateError("Timeout timer has already been started.")
        self._start_connect = current_time()
        return self._start_connect
535896
def spawn_process(self, process=None):
        
        if process is None:
            return False
        # start new child process
        pid = fork()
        if pid != 0:
            # parent process
            process.pid = pid
            self.PROCESSES[process.process_id] = process
            connections.close_all()
            return True
        # child process
        process.pid = getpid()
        # connection.connection.close()
        # connection.connection = None
        process.pre_init_process()
        process.init_process()
        process.run()
        sys.exit(0)
1266682
def pre_init_process(self):
        
        db.connections.close_all()
        # update process info
        BackgroundProcess.objects.filter(pk=self.process_id).update(
            pid=self.pid,
            last_update=now(),
            running_since=now(),
            done=False,
            failed=False,
            message='init process..',
        )

        [signal.signal(s, signal.SIG_DFL) for s in self.SIGNALS]  # reset
        [signal.signal(s, self.signal) for s in self.SIGNALS]
1100578
def start(self, start_loop=True):
        
        txaio.start_logging()
        runner = self.setup_runner()
        if start_loop:
            try:
                runner.run(Component)
            except EventifyHandlerInitializationFailed as initError:
                logging.error('Unable to initialize handler: %s.' % initError.message)
                sys.exit(1)
            except ConnectionRefusedError:
                logging.error('Unable to connect to crossbar instance. Is it running?')
                sys.exit(1)
            except KeyboardInterrupt:
                logging.info('User initiated shutdown')
                loop = asyncio.get_event_loop()
                loop.stop()
                sys.exit(1)
            self.check_event_loop()
            self.reconnect()
        else:
            return runner.run(
                Component,
                start_loop=start_loop
            )
29689
async def startup(self, app):
        """"""
        if self.cfg.fake:
            if not FakeConnection:
                raise PluginException('Install fakeredis for fake connections.')

            self.conn = await FakeConnection.create()
            if self.cfg.pubsub:
                self.pubsub_conn = self.conn

        else:
            try:
                if self.cfg.poolsize <= 1:
                    self.conn = await asyncio.wait_for(
                        asyncio_redis.Connection.create(
                            host=self.cfg.host, port=self.cfg.port,
                            password=self.cfg.password, db=self.cfg.db,
                        ), self.cfg.timeout)
                else:
                    self.conn = await asyncio.wait_for(asyncio_redis.Pool.create(
                        host=self.cfg.host, port=self.cfg.port,
                        password=self.cfg.password, db=self.cfg.db,
                        poolsize=self.cfg.poolsize,
                    ), self.cfg.timeout)
                if self.cfg.pubsub:
                    self.pubsub_conn = await asyncio.wait_for(
                        asyncio_redis.Connection.create(
                            host=self.cfg.host, port=self.cfg.port,
                            password=self.cfg.password, db=self.cfg.db,
                        ), self.cfg.timeout
                    )
            except asyncio.TimeoutError:
                raise PluginException('Muffin-redis connection timeout.')

        if self.cfg.pubsub:
            self.pubsub_subscription = await self.pubsub_conn.start_subscribe()
            self.pubsub_reader = ensure_future(self._pubsub_reader_proc(), loop=self.app.loop)
702488
public function start()
	{
		for ($i = 0; $i < $this->_nProcesses; $i++) {
			$this->_nCurrentProcess = $i;
			$this->_aPids[$i] = $nPid = pcntl_fork();
			if ($nPid == -1) {
				$this->_log('WARNING: Could not fork');
			} else if ($nPid > 0) {
				// Parent process
				$this->_log("INFO: Forked process PID {$nPid}");
				$this->_nRunningProcesses++;
			} else {
				// Child process
				try {
					parent::connect();
				} catch (ApnsPHP_Exception $e) {
					$this->_log('ERROR: ' . $e->getMessage() . ', exiting...');
					exit(1);
				}
				$this->_mainLoop();
				parent::disconnect();
				exit(0);
			}
		}
	}
1000700
protected function onStart()
    {
        do {
            // Disconnect and reconnect
            $this->reconnect();

            // If we successfully connected and we're supposed to be running,
            // call the onConnect event
            if ($this->_conn && ! feof($this->_conn) && $this->_state == parent::STATE_RUNNING) {
                $this->onConnect();
            }

            // Params for stream_select
            $read = array($this->_conn);
            $write = null;
            $except = null;

            $buf = '';

            // Loop while the connection is valid using stream_select with a
            // timeout. The timeout allows us to check to see if a stop has been
            // requested.
            while ($this->_conn && ! feof($this->_conn) &&
                ($count = stream_select($read, $write, $except, $this->_read_timeout))) {
                // Only continue if we're in the right state
                if ($this->_state != parent::STATE_RUNNING) {
                    break;
                }

                if (! $count) {
                    // Nothing waiting, listen again
                    continue;
                }

                // Set the stream as blocking
                stream_set_blocking($this->_conn, 1);
                stream_set_timeout($this->_conn, $this->_stream_timeout);

                // Get the chunk length
                $len = fgets($this->_conn, $this->_max_line_length);
                if ($len === false) {
                    // EOF
                    continue;
                }

                // Read and process each line
                while ($this->_state == parent::STATE_RUNNING &&
                    ($line = fgets($this->_conn, $this->_max_line_length)) !== false) {
                    if (strlen($line) == 0) {
                        // End of the chunk
                        break;
                    }

                    $this->onData($line);
                }

                // Set the stream as non-blocking
                if ($this->_conn) {
                    stream_set_blocking($this->_conn, 0);
                }
            }

            $this->onDisconnect();
        } while ($this->_conn && (! feof($this->_conn) || $this->_auto_reconnect) &&
            $this->_state == parent::STATE_RUNNING);

        // Make sure we're properly disconnected and in a known state
        $this->disconnect();

        // We've stopped for some reason, figure out why
        if ($this->_state == parent::STATE_STOPPING) {
            $reason = 'Stop requested';
        } else {
            $reason = 'Connection dropped';
        }

        // Now tell the user
        $this->onStop($reason);
    }
677375
def main():
    
    # Setup an initial logging handler that buffers log messages before
    # applying the final logging configuration.
    initial_handler = logging.handlers.MemoryHandler(100)
    root_logger = logging.getLogger()
    root_logger.addHandler(initial_handler)

    # Parse configuration and setup logging.
    conf = config.Config(get_config_options())
    conf.parse_args()
    setup_logging(conf)

    # Flush the buffered log messages to the final logging handler.
    initial_handler.setTarget(root_logger.handlers[-1])
    initial_handler.flush()
    root_logger.removeHandler(initial_handler)

    log_startup_info()

    connector = Connector.from_config(conf)

    # Catch SIGTERM and SIGINT to cleanup the connector gracefully
    def signame_handler(signal_name):
        def sig_handler(signum, frame):
            # Save the signal so it can be printed later
            connector.signal = (signal_name, signum)
            connector.can_run = False

        return sig_handler

    signal.signal(signal.SIGTERM, signame_handler("SIGTERM"))
    signal.signal(signal.SIGINT, signame_handler("SIGINT"))

    connector.start()

    while True:
        if not connector.is_alive():
            break
        time.sleep(3)
621207
def start(self):
        
        self.connect()
        if not self.isAlive():
            super(WAMPClient,self).start()
        self.hello()
        return self