void LocalUpdateHandler::updateVideoRegion() { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); unsigned int interval = srvConf->getVideoRecognitionInterval(); DateTime curTime = DateTime::now(); if ((curTime - m_lastVidUpdTime).getTime() > interval) { m_lastVidUpdTime = DateTime::now(); m_vidRegion.clear(); AutoLock al(srvConf); StringVector *classNames = srvConf->getVideoClassNames(); std::vector<HWND> hwndVector; std::vector<HWND>::iterator hwndIter; WindowFinder::findWindowsByClass(classNames, &hwndVector); for (hwndIter = hwndVector.begin(); hwndIter != hwndVector.end(); hwndIter++) { HWND videoHWND = *hwndIter; if (videoHWND != 0) { WINDOWINFO wi; wi.cbSize = sizeof(WINDOWINFO); if (GetWindowInfo(videoHWND, &wi)) { Rect videoRect(wi.rcClient.left, wi.rcClient.top, wi.rcClient.right, wi.rcClient.bottom); videoRect.move(-GetSystemMetrics(SM_XVIRTUALSCREEN), -GetSystemMetrics(SM_YVIRTUALSCREEN)); m_vidRegion.addRect(&videoRect); } } } } }
void DesktopServerProto::sendConfigSettings(BlockingGate *gate) { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); // Log gate->writeUInt32(srvConf->getLogLevel()); // Polling gate->writeUInt32(srvConf->getPollingInterval()); gate->writeUInt8(srvConf->getGrabTransparentWindowsFlag()); // gate->writeUInt8(srvConf->isBlockingLocalInput()); gate->writeUInt8(srvConf->isLocalInputPriorityEnabled()); gate->writeUInt32(srvConf->getLocalInputPriorityTimeout()); gate->writeUInt8(srvConf->isRemovingDesktopWallpaperEnabled()); // Send video class names AutoLock al(srvConf); StringVector *wndClassNames = srvConf->getVideoClassNames(); StringVector::iterator iter = wndClassNames->begin(); size_t stringCount = wndClassNames->size(); gate->writeUInt32((UINT32)stringCount); for (; iter < wndClassNames->end(); iter++) { gate->writeUTF8((*iter).getString()); } // Send video recognition interval gate->writeUInt32(srvConf->getVideoRecognitionInterval()); }
void ControlClient::authMsgRcdv() { UINT8 challenge[16]; UINT8 response[16]; srand((unsigned)time(0)); for (int i = 0; i < sizeof(challenge); i++) { challenge[i] = rand() & 0xff; } m_gate->writeFully(challenge, sizeof(challenge)); m_gate->readFully(response, sizeof(response)); // // FIXME: Is it right to check if password is set after client // sent password to us. // ServerConfig *config = Configurator::getInstance()->getServerConfig(); UINT8 cryptPassword[8]; config->getControlPassword(cryptPassword); bool isAuthSucceed = m_authenticator->authenticate(cryptPassword, challenge, response); if (!isAuthSucceed) { sendError(StringTable::getString(IDS_INVALID_CONTROL_PASSWORD)); } else { m_gate->writeUInt32(ControlProto::REPLY_OK); m_authPassed = true; m_repeatAuthPassed = true; } }
bool WorldNetHandler::sendEventToAllGamed(Event *e) { bool succ = true; for (int i=1; i<=serverConfig.gamedNum(); i++) { int fd = getFdFromId(i); if (fd<0) { if(i <= serverConfig.physicsGameNum()) {//只输出一区 LOG4CXX_ERROR(logger_, "Get Fd from ID failed!! gamed:"<<i<<" fd:"<<" cmd:"<<e->cmd()); } continue; } e->set_worldsrvid(nid_); string text; e->SerializeToString(&text); text = "ev,"+text; //LOG4CXX_DEBUG(logger_, "event:"<<e->DebugString()<<"to fd:"<<fd<<" with size:"<<text.length()); bool sendSucc = sendIntSizedFdString(fd, text); if (!sendSucc) { LOG4CXX_ERROR(logger_, "Write to cache failed!!"); } //LOG4CXX_DEBUG(logger_, "sendEventToAllGamed, event: " << e->cmd() << ", size: " << text.size() << ", target fd: " << fd << ", write to cache: " << sendSucc); succ = succ && sendSucc; } return succ; }
void Proftpd::initialize(ServerConfig & config) { m_serverName = config.get(ServerConfig::serverNameName); m_serverAddr = config.get(ServerConfig::serverAddrName); m_binPath = config.get(ServerConfig::binPathName); m_configFile = config.get(ServerConfig::configFileName); }
void RfbServer::onAcceptConnection(SocketIPv4 *socket) { try { // Get incoming connection address and convert it to string. SocketAddressIPv4 peerAddr; socket->getPeerAddr(&peerAddr); StringStorage peerIpString; peerAddr.toString(&peerIpString); m_log->message(_T("Incoming rfb connection from %s"), peerIpString.getString()); struct sockaddr_in addr_in = peerAddr.getSockAddr(); // Check access control rules for the IP address of the peer. // FIXME: Check loopback-related rules separately, report differently. ServerConfig *config = Configurator::getInstance()->getServerConfig(); IpAccessRule::ActionType action = config->getActionByAddress((unsigned long)addr_in.sin_addr.S_un.S_addr); if (action == IpAccessRule::ACTION_TYPE_DENY) { m_log->message(_T("Connection rejected due to access control rules")); delete socket; return; } // Access granted, add new RFB client. One more check will follow later in // RfbClientManager::onCheckAccessControl(). socket->enableNaggleAlgorithm(false); m_clientManager->addNewConnection(socket, &m_viewPort, false, false); } catch (Exception &ex) { m_log->error(_T("Failed to process incoming rfb connection with following reason: \"%s\""), ex.getMessage()); } }
// Return open index for given key or 0 Index *open_index(xmlrpc_env *env, int key) { try { ServerConfig config; if (!get_config(env, config)) return 0; stdString index_name; if (!config.find(key, index_name)) { xmlrpc_env_set_fault_formatted(env, ARCH_DAT_NO_INDEX, "Invalid key %d", key); return 0; } LOG_MSG("Open index, key %d = '%s'\n", key, index_name.c_str()); AutoPtr<Index> index(new AutoIndex()); if (!index) { xmlrpc_env_set_fault_formatted(env, ARCH_DAT_NO_INDEX, "Cannot allocate index"); return 0; } index->open(index_name); return index.release(); } catch (GenericException &e) { LOG_MSG("Error: %s\n", e.what()); xmlrpc_env_set_fault_formatted(env, ARCH_DAT_NO_INDEX, "%s", e.what()); } return 0; }
void DesktopServerProto::readConfigSettings(BlockingGate *gate) { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); // Log srvConf->setLogLevel(gate->readUInt32()); // Polling srvConf->setPollingInterval(gate->readUInt32()); srvConf->setGrabTransparentWindowsFlag(gate->readUInt8() != 0); srvConf->blockLocalInput(gate->readUInt8() != 0); srvConf->setLocalInputPriority(gate->readUInt8() != 0); srvConf->setLocalInputPriorityTimeout(gate->readUInt32()); srvConf->enableRemovingDesktopWallpaper(gate->readUInt8() != 0); // Receive video class names AutoLock al(srvConf); size_t stringCount = gate->readUInt32(); StringStorage tmpString; for (size_t i = 0; i < stringCount; i++) { gate->readUTF8(&tmpString); srvConf->getVideoClassNames()->push_back(tmpString); } // Receive video recognition interval srvConf->setVideoRecognitionInterval(gate->readUInt32()); }
UpdateScreen::UpdateScreen(const CompanyDefn& company) : QMainWindow(0, "UpdateScreen", WType_TopLevel | WDestructiveClose), _connection(NULL) { QFrame* frame = new QFrame(this); QLabel* fromLabel = new QLabel(tr("From Version:"), frame); _fromVersion = new LineEdit(14, frame); _fromVersion->setFocusPolicy(NoFocus); QLabel* toLabel = new QLabel(tr("To Version:"), frame); _toVersion = new ComboBox(frame); toLabel->setBuddy(_toVersion); QFrame* buttons = new QFrame(frame); _update = new QPushButton(tr("&Update"), buttons); _close = new QPushButton(tr("&Close"), buttons); connect(_update, SIGNAL(clicked()), SLOT(slotUpdate())); connect(_close, SIGNAL(clicked()), SLOT(slotClose())); QGridLayout* buttonGrid = new QGridLayout(buttons); buttonGrid->setSpacing(6); buttonGrid->setMargin(6); buttonGrid->setColStretch(0, 1); buttonGrid->addWidget(_update, 0, 1); buttonGrid->addWidget(_close, 0, 2); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(3); grid->setMargin(3); grid->setColStretch(2, 1); grid->addColSpacing(2, 20); grid->addWidget(fromLabel, 0, 0); grid->addWidget(_fromVersion, 0, 1, AlignLeft | AlignVCenter); grid->addWidget(toLabel, 0, 3); grid->addWidget(_toVersion, 0, 4, AlignLeft | AlignVCenter); grid->addMultiCellWidget(buttons, 1, 1, 0, 4); ServerConfig config; config.load(); _fromVersion->setText(company.version()); QDir dir(parseDir(config.dataDir), "*.xml"); dir.cd("models"); QStringList entries = dir.entryList(); for (unsigned int i = 0; i < entries.size(); ++i) { QString version = QFileInfo(entries[i]).baseName(); if (version < company.version()) continue; _toVersion->insertItem(version); } _toVersion->setCurrentItem(company.version()); _company = company; setCentralWidget(frame); setCaption(tr("Version Update: %1").arg(company.name())); }
void DesktopConfigLocal::updateByNewSettings(BlockingGate *gate) { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); bool hardBlocking = srvConf->isBlockingLocalInput(); m_inputBlocker->setKeyboardBlocking(hardBlocking); m_inputBlocker->setMouseBlocking(hardBlocking); bool softBlocking = srvConf->isLocalInputPriorityEnabled(); unsigned int interval = srvConf->getLocalInputPriorityTimeout() * 1000; m_inputBlocker->setSoftKeyboardBlocking(softBlocking, interval); m_inputBlocker->setSoftMouseBlocking(softBlocking, interval); }
ModelEdit::ModelEdit(ModelMainWindow* main, const QString& version) : QMainWindow(NULL, "ModelEdit", WDestructiveClose), _main(main) { createWidgets(); ServerConfig config; config.load(); QString dataDir = parseDir(config.dataDir); _orig.load(dataDir + "/models/" + version + ".xml"); _curr = _orig; setWidgets(); }
void ExtraRfbServers::getConfiguration(Conf *out) { // ConfigAccessor ca; // ServerConfig *cfg = ca.getServerConfig(); // someSetting = cfg.getSomeSetting(); // } ServerConfig *config = Configurator::getInstance()->getServerConfig(); AutoLock l(config); out->acceptConnections = config->isAcceptingRfbConnections(); out->loopbackOnly = config->isOnlyLoopbackConnectionsAllowed(); out->extraPorts = *config->getPortMappingContainer(); }
int ConnectServer::init(const std::string& conf_file){ ServerConfig conf; int ret = conf.init(conf_file); if(ret < 0){ std::cout << "config init fail, ret:" << ret << std::endl; return ret; } ret = init(conf); return ret; }
static ServerConfig extractServerConfig(DOMDocument * domDocument, DOMTreeWalker * domTreeWalker) { ServerConfig serverConfig; DOMNode * node = domTreeWalker->getCurrentNode(); while (node) { if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "ServerStartupConfig") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setServerStartupConfig(extractServerStartupConfig(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "DeviceTypeSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setDeviceTypeMap(extractDeviceTypeMap(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "DeviceInstanceSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setDeviceInstanceMap(extractDeviceInstanceMap(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "TUIObjectTypeSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setTUIObjectTypeMap(extractTUIObjectTypeMap(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "TUIObjectInstanceSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setTUIObjectInstanceMap(extractTUIObjectInstanceMap(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "ConnectorSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setConnectorVector(extractConnectorVector(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "MSPTypeSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); //serverConfig.setMSPTypeMap(extractMSPTypeMap(domDocument, d)); d->release(); delete nodeFilter; } else if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "MSPInstanceSequence") == 0) { XMLNodeFilter * nodeFilter = new XMLNodeFilter(); DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true); serverConfig.setMSPInstanceMap(extractMSPInstanceMap(domDocument, d)); d->release(); delete nodeFilter; } node = domTreeWalker->nextNode(); } return serverConfig; }
void WallpaperUtil::updateWallpaper() { try { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); if (srvConf->isRemovingDesktopWallpaperEnabled()) { Environment::disableWallpaper(); Log::info(_T("Wallpaper was successfully disabled")); } else { Environment::restoreWallpaper(); Log::info(_T("Wallpaper was successfully restored")); } } catch (Exception &e) { Log::error(e.getMessage()); } }
int PlatNetHandler::initSockets() { int port = serverConfig.plat_gamed_Port(G_PlatSrvD_ID); string addr = serverConfig.plat_bind_ip(G_PlatSrvD_ID); gamedfd = createListenSocket("plat", toString(port), addr); if (gamedfd<0) { return -1; } last_keepalive_check = 0; #ifdef _WIN32 // for windows return gamedfd; #else // for linux return 0; #endif }
bool PlatNetHandler::sendEvnetToOneGamed(Event *e) { bool succ = false; for (int i=1; i<=serverConfig.gamedNum(); i++) { int fd = getFdFromId(i); if (fd<0) { LOG4CXX_ERROR(logger_, "Get Fd from ID failed!! gamed:"<<i<<" fd:"<<" cmd:"<<e->cmd()); continue; } string text; e->SerializeToString(&text); text = "ev,"+text; //LOG4CXX_DEBUG(logger_, "event:"<<e->DebugString()<<"to fd:"<<fd<<" with size:"<<text.length()); succ = sendIntSizedFdString(fd, text); if (!succ) { LOG4CXX_ERROR(logger_, "Write to cache failed!!"); } else { break; } //LOG4CXX_DEBUG(logger_, "sendEventToAllGamed, event: " << e->cmd() << ", size: " << text.size() << ", target fd: " << fd << ", write to cache: " << sendSucc); } return succ; }
void RfbInitializer::checkForLoopback() { SocketAddressIPv4 sockAddr; m_client->getSocketAddr(&sockAddr); struct sockaddr_in addrIn = sockAddr.getSockAddr(); bool isLoopback = (unsigned long)addrIn.sin_addr.S_un.S_addr == 16777343; ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); if (isLoopback && !srvConf->isLoopbackConnectionsAllowed()) { throw Exception(_T("Sorry, loopback connections are not enabled")); } if (srvConf->isOnlyLoopbackConnectionsAllowed() && !isLoopback) { throw Exception(_T("Your connection has been rejected")); } }
void RfbInitializer::sessionPhase() { Configurator *conf = Configurator::getInstance(); ServerConfig *srvConf = conf->getServerConfig(); unsigned int id = srvConf->getLastSessionId(); m_input->readUTF8(&m_organization); m_output->writeUInt32(id); m_sessionId = m_input->readUInt32(); if (m_sessionId != id) { srvConf->setLastSessionId(m_sessionId); conf->save(); } }
void ImportScreen::slotOpenFile() { QString start = _filePath->text(); QString filter = "Import Files (*.xml)"; if (start.isEmpty()) { ServerConfig config; config.load(); start = parseDir(config.importDir); } QString file = QFileDialog::getOpenFileName(start, filter, this); if (file.isEmpty()) return; _filePath->setText(file); }
void RfbInitializer::doVncAuth() { UINT8 challenge[16]; srand((unsigned)time(0)); for (int i = 0; i < sizeof(challenge); i++) { challenge[i] = rand() & 0xff; } m_output->writeFully(challenge, sizeof(challenge)); UINT8 response[16]; m_input->readFully(response, sizeof(response)); // Checking for a ban after auth. checkForBan(); // Comparing the challenge with the response. ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); bool hasPrim = srvConf->hasPrimaryPassword(); bool hasRdly = srvConf->hasReadOnlyPassword(); if (!hasPrim && !hasRdly) { throw AuthException(_T("Server is not configured properly")); } if (hasPrim) { UINT8 crypPrimPass[8]; srvConf->getPrimaryPassword(crypPrimPass); VncPassCrypt passCrypt; passCrypt.updatePlain(crypPrimPass); if (passCrypt.challengeAndResponseIsValid(challenge, response)) { return; } } if (hasRdly) { UINT8 crypReadOnlyPass[8]; srvConf->getReadOnlyPassword(crypReadOnlyPass); VncPassCrypt passCrypt; passCrypt.updatePlain(crypReadOnlyPass); if (passCrypt.challengeAndResponseIsValid(challenge, response)) { m_viewOnlyAuth = true; return; } } // At this time we are sure that the client was typed an incorectly password. m_extAuthListener->onAuthFailed(m_client); throw AuthException(_T("Authentication failed")); }
void ExtraRfbServers::getConfiguration(Conf *out) { // FIXME: Create a sort of configuration accessor with auto-locking, and // do not allow to access the configuration directly, so we would // have to write something like this: // { // ConfigAccessor ca; // lock // ServerConfig *cfg = ca.getServerConfig(); // get access // someSetting = cfg.getSomeSetting(); // use // } // auto-unlock // ServerConfig *config = Configurator::getInstance()->getServerConfig(); AutoLock l(config); out->acceptConnections = config->isAcceptingRfbConnections(); out->loopbackOnly = config->isOnlyLoopbackConnectionsAllowed(); out->extraPorts = *config->getPortMappingContainer(); }
void RfbInitializer::doVncAuth() { UINT8 challenge[16]; srand((unsigned)time(0)); for (int i = 0; i < sizeof(challenge); i++) { challenge[i] = rand() & 0xff; } m_output->writeFully(challenge, sizeof(challenge)); UINT8 response[16]; m_input->readFully(response, sizeof(response)); // Checking for a ban after auth. checkForBan(); // Comparing the challenge with the response. ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); bool hasPrim = srvConf->hasPrimaryPassword(); if (!hasPrim) { throw AuthException(_T("Server is not configured properly")); } if (hasPrim) { UINT8 primPass[8]; srvConf->getPrimaryPassword(primPass); VncPassCrypt passCrypt; passCrypt.setPlain(primPass); if (passCrypt.challengeAndResponseIsValid(challenge, response)) { return; } } // At this time we are sure that the client was typed an incorectly password. m_extAuthListener->onAuthFailed(m_client); StringStorage clientAddressStorage; m_client->getPeerHost(&clientAddressStorage); StringStorage errMess; errMess.format(_T("Authentication failed from %s"), clientAddressStorage.getString()); throw AuthException(errMess.getString()); }
void PlatNetHandler::keepAliveWithGame(time_t now) { if ((now-last_keepalive_check)>30000) { last_keepalive_check = now; for (int i=1; i<=serverConfig.gamedNum(); i++) { int fd = getFdFromId(i); if (fd>0) { sendIntSizedFdString(fd, "ka"); } } } }
bool ModelEdit::slotOk() { getWidgets(); if (_curr != _orig) { ServerConfig config; config.load(); QString dataDir = parseDir(config.dataDir); _curr.save(dataDir + "/models/" + _curr.version + ".xml"); if (_curr.version != _orig.version) QFile::remove(dataDir + "/models/" + _orig.version + ".xml"); // TODO: inform model_main_window of changes } _orig = _curr; close(); return true; }
int WorldNetHandler::initSockets() { int port = serverConfig.worlddGamedPort( G_WorldD_ID); string addr = serverConfig.worlddIp(G_WorldD_ID); gamedfd = createListenSocket("gamed", toString(port), addr); if (gamedfd<0) { return -1; } port = serverConfig.worlddWebPort(G_WorldD_ID); addr = serverConfig.worlddIp(G_WorldD_ID); wsfd = createListenSocket("web", toString(port), addr); if (gamedfd<0) { return -1; } last_keepalive_check = 0; #ifdef _WIN32 // for windows return max(gamedfd, wsfd); #else // for linux return 0; #endif }
bool get_config(xmlrpc_env *env, ServerConfig &config) { const char *config_name = get_config_name(env); if (env->fault_occurred) return false; if (!config.read(config_name)) { xmlrpc_env_set_fault_formatted(env, ARCH_DAT_NO_INDEX, "Cannot open config '%s'", config_name); return false; } return true; }
void RfbClientManager::onCheckAccessControl(RfbClient *client) { SocketAddressIPv4 peerAddr; try { client->getSocketAddr(&peerAddr); } catch (...) { throw AuthException(_T("Failed to get IP address of the RFB client")); } struct sockaddr_in addr_in = peerAddr.getSockAddr(); ServerConfig *config = Configurator::getInstance()->getServerConfig(); IpAccessRule::ActionType action; if (!client->isOutgoing()) { action = config->getActionByAddress((unsigned long)addr_in.sin_addr.S_un.S_addr); } else { action = IpAccessRule::ACTION_TYPE_ALLOW; } // Promt user to know what to do with incmoing connection. if (action == IpAccessRule::ACTION_TYPE_QUERY) { StringStorage peerHost; peerAddr.toString(&peerHost); int queryRetVal = QueryConnectionApplication::execute(peerHost.getString(), config->isDefaultActionAccept(), config->getQueryTimeout()); if (queryRetVal == 1) { throw AuthException(_T("Connection has been rejected")); } } }
BuiltinServer::BuiltinServer(QObject *parent) : QObject(parent), m_server(nullptr), m_state(NOT_STARTED) { // Fixed configuration ServerConfig *servercfg = new InMemoryConfig(this); QSettings cfg; cfg.beginGroup("settings/server"); servercfg->setConfigInt(config::SessionSizeLimit, cfg.value("historylimit", 0).toFloat() * 1024 * 1024); servercfg->setConfigInt(config::SessionCountLimit, 1); servercfg->setConfigBool(config::PrivateUserList, cfg.value("privateUserList", false).toBool()); servercfg->setConfigInt(config::ClientTimeout, cfg.value("timeout", 60).toInt()); m_sessions = new SessionServer(servercfg, this); connect(m_sessions, &SessionServer::sessionEnded, this, &BuiltinServer::stop); connect(m_sessions, &SessionServer::userDisconnected, [this]() { // The server will be fully stopped after all users have disconnected if(m_state == STOPPING) stop(); }); }
void DesktopServerProto::readConfigSettings(BlockingGate *gate) { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); // Log srvConf->setLogLevel(gate->readUInt32()); // Polling srvConf->setPollingInterval(gate->readUInt32()); srvConf->setGrabTransparentWindowsFlag(gate->readUInt8() != 0); srvConf->blockLocalInput(gate->readUInt8() != 0); srvConf->setLocalInputPriority(gate->readUInt8() != 0); srvConf->setLocalInputPriorityTimeout(gate->readUInt32()); srvConf->enableRemovingDesktopWallpaper(gate->readUInt8() != 0); }