Esempio n. 1
0
void reload(void)
{
	notify_reload();

	restart();
	conf_read(conf_file, do_vifs);

	/* Acknowledge client SIGHUP/reload */
	notify_ready(NULL, uid, gid);
}
Esempio n. 2
0
void quorum_notify_status(BackendDB *bd, int rid, int ready) {
	assert(rid > -1 || rid <= SLAP_SYNC_RID_MAX);
	assert(quorum_list != QR_POISON);

	if (bd->bd_quorum) {
		lock();
		if (bd->bd_quorum && notify_ready(bd->bd_quorum, rid, ready > 0))
			quorum_invalidate(bd);
		unlock();
	}
}
Esempio n. 3
0
void Connection::on_ready() {
  if (state_ == CONNECTION_STATE_CONNECTED && listener_->event_types() != 0) {
    set_state(CONNECTION_STATE_REGISTERING_EVENTS);
    internal_write(new StartupHandler(this, new RegisterRequest(listener_->event_types())));
    return;
  }

  if (keyspace_.empty()) {
    notify_ready();
  } else {
    internal_write(new StartupHandler(this, new QueryRequest("USE \"" + keyspace_ + "\"")));
  }
}
Esempio n. 4
0
void Connection::on_ready() {
  if (!is_registered_for_events_ && listener_->event_types() != 0) {
    is_registered_for_events_ = true;
    write(new StartupHandler(this, new RegisterRequest(listener_->event_types())));
    return;
  }

  if (keyspace_.empty()) {
    notify_ready();
  } else {
    write(new StartupHandler(this, new QueryRequest("use \"" + keyspace_ + "\"")));
  }
}
Esempio n. 5
0
void Connection::on_set_keyspace() {
  notify_ready();
}
Esempio n. 6
0
/* Init everything before forking, so we can fail and return an
 * error code in the parent and the initscript will fail */
static int start_server(void)
{
	int api = 2, busy = 0;

	if (geteuid() != 0) {
		smclog(LOG_ERR, "Need root privileges to start %s", prognm);
		return 1;
	}

	if (background) {
		if (daemon(0, 0) < 0) {
			smclog(LOG_ERR, "Failed daemonizing: %s", strerror(errno));
			return 1;
		}
	}

	/* Hello world! */
	smclog(LOG_NOTICE, "%s", version_info);

	if (startup_delay > 0) {
		smclog(LOG_INFO, "Startup delay requested, waiting %d sec before continuing.", startup_delay);
		sleep(startup_delay);
	}

	/*
	 * Timer API needs to be initilized before mroute4_enable()
	 */
	timer_init();

	/*
	 * Build list of multicast-capable physical interfaces
	 */
	iface_init();

	if (mroute4_enable(do_vifs, table_id, cache_tmo)) {
		if (errno == EADDRINUSE)
			busy++;
		api--;
	}

	if (mroute6_enable(do_vifs, table_id)) {
		if (errno == EADDRINUSE)
			busy++;
		api--;
	}

	/* At least one API (IPv4 or IPv6) must have initialized successfully
	 * otherwise we abort the server initialization. */
	if (!api) {
		if (busy)
			smclog(LOG_ERR, "Another multicast routing application is already running.");
		else
			smclog(LOG_ERR, "Kernel does not support multicast routing.");
		exit(1);
	}

	atexit(clean);
	signal_init();
	ipc_init();

	conf_read(conf_file, do_vifs);

	/* Everything setup, notify any clients waiting for us */
	notify_ready(pid_file, uid, gid);

	/* Drop root privileges before entering the server loop */
	cap_drop_root(uid, gid);

	return server_loop();
}