void PeerAdmin::run() { try { while (m_enabled) { if (m_selector.select() && m_enabled) { auto list = m_selector.selectedKeys(); for(auto it = list.begin(); it != list.end(); it++) { SelectionKeyPtr key = *it; if (!key->isValid()) { continue; } if (key->channel().instanceof<ServerSocketChannel>()) { processServer(key->channel(), key->attachment()); } else if (key->channel().instanceof<SocketChannel>()) { processPeer(key->attachment()); } } } } } catch (ParserException &e) { if (m_enabled) { logFine() << __demangle(typeid(*this).name()) << " leaving main loop normally"; } else { logCrit() << __demangle(typeid(*this).name()) << " leaving main loop after throwing an instance of '" << __demangle(typeid(e).name()) << "'"; if (!e.message().isEmpty()) logCrit() << " what(): " << e.message(); } } catch (Exception &e) { logCrit() << __demangle(typeid(*this).name()) << " leaving main loop after throwing an instance of '" << __demangle(typeid(e).name()) << "'"; if (!e.message().isEmpty()) logCrit() << " what(): " << e.message(); } cancel(); }
void Sender::readSock() { //receive //buffer.append(QString::fromUtf8(sock->readAll())); buf+=QString::fromUtf8(sock->readAll()); //qDebug(buf.toUtf8()); //process data while(processServer()); }
void Visualight::update(){ if(isServer){ processServer(); } else{ processClient(); } processButton(); //TODO: test to see how much blockage this has... if(alerting && (millis() % 5)==0) alert(); }
MuHttpServer::MuHttpServer(int port, QObject *pParent) : QObject(pParent), mpTimer(NULL), mServerIsRunning(false), mAllowNonLocal(false), mSession(SIGNAL_NAME(SessionManager, Closed), Slot(this, &MuHttpServer::stop)) { if (port > 0) { setObjectName("mu HTTP server"); mParams["port"] = port; mParams["mode"] = "singlethreaded"; mpTimer = new QTimer(this); mpTimer->setSingleShot(false); mpTimer->setInterval(250); connect(mpTimer, SIGNAL(timeout()), this, SLOT(processServer())); } }
/********************************************************************* ** Traverse the drivers list, check for updated drivers and take ** appropriate action *********************************************************************/ void INDIMenu::updateStatus() { INDIDriver *drivers = ksw->getINDIDriver(); // Local/Server processServer(); if (drivers) { if (drivers->activeDriverCount() == 0) { KMessageBox::error(0, i18n("No INDI devices currently running. To run devices, please select devices from the Device Manager in the devices menu.")); return; } } else if (mgr.count() == 0) { KMessageBox::error(0, i18n("No INDI devices currently running. To run devices, please select devices from the Device Manager in the devices menu.")); return; } show(); }