Ejemplo n.º 1
0
/*!
 * Запуск сервера.
 */
void DaemonUi::start()
{
  m_feeds = new FeedsCore(this);

  m_storage = new Storage(m_settings, Path::app(), this);
  if (m_storage->start()) {
    m_feeds->deleteLater();
    m_feeds = 0;

    m_storage->deleteLater();
    m_storage = 0;

    setState(Error);
    return;
  }

  m_core    = new Core(this);
  m_plugins = new NodePlugins(this);
  m_plugins->load();

  const QStringList listen = m_settings->value(STORAGE_LISTEN).toStringList();
  const int workers = m_settings->value(STORAGE_WORKERS).toInt();

  m_pool = new NodePool(listen, workers, m_core);
  connect(m_pool, SIGNAL(ready(QObject*)), m_core, SLOT(workerReady(QObject*)));
  connect(m_pool, SIGNAL(listen(QStringList)), SLOT(onListen(QStringList)));

  m_core->start();
  m_pool->start();

  m_storage->load();
}
	QtUdpSocketPlugin::QtUdpSocketPlugin() : _socket(nullptr), _helperReceiveCallback(), _checkerReceiveCallback(), _messageCounter(0), _conditionLock(), _conditionVariable(), _targetHost(), _targetPort(0) {
		QObject::connect(this, SIGNAL(doListen(quint16)), this, SLOT(onListen(quint16)));
		QObject::connect(this, SIGNAL(doConnect(QString, quint16)), this, SLOT(onConnect(QString, quint16)));
		QObject::connect(this, SIGNAL(doSendMessage(QString)), this, SLOT(onSendMessage(QString)));
		QObject::connect(this, SIGNAL(doDisconnect()), this, SLOT(onDisconnect()));
	}