void TICC1100::startListening() { try { stopListening(); initDevice(); _stopped = false; _firstPacket = true; _stopCallbackThread = false; if(_settings->listenThreadPriority > -1) GD::bl->threadManager.start(_listenThread, true, _settings->listenThreadPriority, _settings->listenThreadPolicy, &TICC1100::mainThread, this); else GD::bl->threadManager.start(_listenThread, true, &TICC1100::mainThread, this); IPhysicalInterface::startListening(); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
/** Called when STK exits. It stops the listening thread and the * ProtocolManager. */ void STKHost::abort() { // Finish protocol manager first, to avoid that it access data // in STKHost. ProtocolManager::getInstance()->abort(); stopListening(); } // abort
uint8_t BayRF24::sendPayload(void) { if (_powerdown) powerUp(); else stopListening(); openWritingPipe (_pipe); uint8_t res; res = RF24::write(getPayload(), getPacketLength()); uint8_t curr_pa = 0; while (!res && curr_pa < 4) { setPALevel((rf24_pa_dbm_e) curr_pa); delayMicroseconds(random(2000)); res = RF24::write(getPayload(), getPacketLength()); curr_pa++; } if (_powerdown) powerDown(); else { txStandBy(); startListening(); } return !res; }
void ProxygenServer::stop() { if (getStatus() != RunStatus::RUNNING || m_shutdownState != ShutdownState::SHUTDOWN_NONE) return; Logger::Info("%p: Stopping ProxygenServer port=%d", this, m_port); setStatus(RunStatus::STOPPING); if (m_takeover_agent) { m_worker.getEventBase()->runInEventBaseThread([this] { m_takeover_agent->stop(); }); } // close listening sockets, this will initiate draining, including closing // idle conns m_worker.getEventBase()->runInEventBaseThread([this] { // Only wait ServerPreShutdownWait seconds for the page server. int delayMilliSeconds = RuntimeOption::ServerPreShutdownWait * 1000; if (delayMilliSeconds < 0 || getPort() != RuntimeOption::ServerPort) { delayMilliSeconds = 0; } m_worker.getEventBase()->runAfterDelay([this] { stopListening(); }, delayMilliSeconds); reportShutdownStatus(); }); }
void InsteonHubX10::startListening() { try { stopListening(); _socket = RPC::SocketOperations(_settings->hostname, _settings->port, _settings->ssl, _settings->verifyCertificate); Output::printDebug("Connecting to Insteon Hub X10 with Hostname " + _settings->hostname + " on port " + _settings->port + "..."); _socket.open(); Output::printInfo("Connected to Insteon Hub X10 with Hostname " + _settings->hostname + " on port " + _settings->port + "."); _stopped = false; _listenThread = std::thread(&InsteonHubX10::listen, this); Threads::setThreadPriority(_listenThread.native_handle(), 45); } catch(const std::exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(Exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
void ThriftServer::cleanUp() { DCHECK(!serverChannel_); // It is users duty to make sure that setup() call // should have returned before doing this cleanup idleServer_.clear(); serveEventBase_ = nullptr; stopListening(); // Stop the routing handlers. for (auto& handler : routingHandlers_) { handler->stopListening(); } if (stopWorkersOnStopListening_) { // Wait on the i/o worker threads to actually stop stopWorkers(); } // Now clear all the handlers routingHandlers_.clear(); // Force the cred processor to stop polling if it's set up tlsCredProcessor_.reset(); }
void CUNO::startListening() { try { stopListening(); _socket = std::unique_ptr<BaseLib::SocketOperations>(new BaseLib::SocketOperations(_bl, _settings->host, _settings->port, _settings->ssl, _settings->caFile, _settings->verifyCertificate)); _socket->setAutoConnect(false); _out.printDebug("Connecting to CUNO with hostname " + _settings->host + " on port " + _settings->port + "..."); _stopped = false; _listenThread = std::thread(&CUNO::listen, this); if(_settings->listenThreadPriority > -1) BaseLib::Threads::setThreadPriority(_bl, _listenThread.native_handle(), _settings->listenThreadPriority, _settings->listenThreadPolicy); IPhysicalInterface::startListening(); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
/* CTextureCanvas::clearTexture * Clears the current texture and the patch textures list *******************************************************************/ void CTextureCanvas::clearTexture() { // Stop listening to the current texture (if it exists) if (texture) stopListening(texture); // Clear texture; texture = NULL; // Clear patch textures clearPatchTextures(); // Reset view offset resetOffsets(); // Clear patch selection selected_patches.clear(); hilight_patch = -1; // Clear full preview tex_preview.clear(); // Refresh canvas Refresh(); }
listener::~listener() { if (listening) { stopListening(); } free(id); id = NULL; }
void SoftwareSerial::end() { if (_receive_buffer != NULL) { free(_receive_buffer); _receive_buffer = NULL; } stopListening(); }
Server::~Server() { stopListening(); delete m_socketGroup; delete m_acceptCmd; delete m_readCmd; delete m_disconnectCmd; }
void UndoListView::setManager(UndoManager* manager) { if (this->manager) stopListening(this->manager); this->manager = manager; listenTo(manager); SetItemCount(manager->nUndoLevels()); }
/* UndoListView::setManager * Sets the undo [manager] to show in the list *******************************************************************/ void UndoListView::setManager(UndoManager* manager) { if (this->manager) stopListening(this->manager); this->manager = manager; listenTo(manager); updateFromManager(); }
void IsoServer_stopListeningThreadless(IsoServer self) { stopListening(self); closeAllOpenClientConnections(self); if (DEBUG_ISO_SERVER) printf("ISO_SERVER: IsoServer_stopListeningThreadless finished!\n"); }
void PlatformEventDispatcher::removeController(PlatformEventController* controller) { ASSERT(m_controllers.contains(controller)); m_controllers.remove(controller); if (!m_isDispatching && m_controllers.isEmpty()) { stopListening(); m_isListening = false; } }
// ----------------------------------------------------------------------------- // Sets the undo [manager] to show in the list // ----------------------------------------------------------------------------- void UndoListView::setManager(UndoManager* manager) { if (manager_) stopListening(manager_); manager_ = manager; listenTo(manager); updateFromManager(); }
////////////////////////////////////////////////////////////////////// // MANIPULATORS ////////////////////////////////////////////////////////////////////// int TaoTransportTask::startListening( void ) { #ifdef TAO_REMOTING stopListening(); mpListenSocket = new OsServerSocket(64, mListenerPort); mpTaoListeningTask = new TaoListeningTask((OsServerTask *)mpServer, mpListenSocket); mpTaoListeningTask->start(); #endif return 0; }
void Sensor::stop(ScriptState*, ExceptionState& exceptionState) { if (m_state == Sensor::SensorState::Idle || m_state == Sensor::SensorState::Errored) { exceptionState.throwDOMException( InvalidStateError, "Cannot stop because SensorState is either Idle or errored"); return; } stopListening(); }
void ThriftServer::cleanUp() { // It is users duty to make sure that setup() call // should have returned before doing this cleanup serveEventBase_ = nullptr; stopListening(); if (stopWorkersOnStopListening_) { // Wait on the i/o worker threads to actually stop stopWorkers(); } }
void TEventServer::cleanUp() { // It is users duty to make sure that setup() call // should have returned before doing this cleanup serveEventBase_ = nullptr; stopListening(); // wait on the worker threads to actually stop for (auto& worker: workers_) { worker.thread->join(); } workers_.clear(); }
InterfaceManagerImpl::~InterfaceManagerImpl() { if(mNetManagerProxy != nullptr){ g_object_unref (mNetManagerProxy); } if(mLoop != nullptr) { stopListening(); g_main_loop_unref (mLoop); } }
TaoTransportTask::~TaoTransportTask() { stopListening(); if (--mRef < 1) { if (mpTransactionCnt) { delete mpTransactionCnt; mpTransactionCnt = 0; } } }
int ProxygenServer::onTakeoverRequest(TakeoverAgent::RequestType type) { if (type == TakeoverAgent::RequestType::LISTEN_SOCKET) { // Subsequent calls to ProxygenServer::stop() won't do anything. // The server continues accepting until RequestType::TERMINATE is // seen. setStatus(RunStatus::STOPPING); } else if (type == TakeoverAgent::RequestType::TERMINATE) { stopListening(true /*hard*/); // No need to do m_takeover_agent->stop(), as the afdt server is // going to be closed when this returns. } return 0; }
TcpServerListener::~TcpServerListener() { stopListening(); serverThread->quit(); serverThread->wait(); delete server; if (workerThread != NULL) { workerThread->quit(); workerThread->wait(); delete workerThread; } }
void TcpServerListener::stopListening() { if (server != NULL && server->isListening()) { emit status(tr("TCP server stopped %1:%2").arg(listeningAddress.toString()).arg(port), ""); server->close(); for (int i = 0; i < clients.size(); i++) QTimer::singleShot(0,clients.at(i),SLOT(stopListening())); stoppingWorkers(); emit stopped(); delete server; server = NULL; } }
void MainWindow::toggleRun(bool buttonPressed) { if (buttonPressed) { ui->pushButtonRun->setText("stop"); params->setOutputDir(ui->lineEdit->text()); qDebug() << "Setting output dir: " << params->getOutDir().absolutePath(); emit startListening(); } else { emit stopListening(); ui->pushButtonRun->setText("run "); newSession(); } }
void Server::stop() { try { if (!m_running) return; for (unsigned int i = 0; i < m_socketGroup->size(); ++i) m_socketGroup->remove(i); stopListening(); } catch (NL::Exception e) { throw std::runtime_error("An error occured while stopping server. " + std::string(e.what())); } catch (...) { throw std::runtime_error("An error occured while stopping server."); } m_running = false; }
void DlgPrefController::showLearningWizard() { // If the user has checked the "Enabled" checkbox but they haven't hit OK to // apply it yet, prompt them to apply the settings before we open the // learning dialog. If we don't apply the settings first and open the // device, the dialog won't react to controller messages. if (m_ui.chkEnabledDevice->isChecked() && !m_pController->isOpen()) { QMessageBox::StandardButton result = QMessageBox::question( this, tr("Apply device settings?"), tr("Your settings must be applied before starting the learning wizard.\n" "Apply settings and continue?"), QMessageBox::Ok | QMessageBox::Cancel, // Buttons to be displayed QMessageBox::Ok); // Default button // Stop if the user has not pressed the Ok button, // which could be the Cancel or the Close Button. if (result != QMessageBox::Ok) { return; } } slotApply(); // After this point we consider the mapping wizard as dirtying the preset. slotDirty(); // Note that DlgControllerLearning is set to delete itself on close using // the Qt::WA_DeleteOnClose attribute (so this "new" doesn't leak memory) m_pDlgControllerLearning = new DlgControllerLearning(this, m_pController); m_pDlgControllerLearning->show(); ControllerLearningEventFilter* pControllerLearning = m_pControllerManager->getControllerLearningEventFilter(); pControllerLearning->startListening(); connect(pControllerLearning, SIGNAL(controlClicked(ControlObject*)), m_pDlgControllerLearning, SLOT(controlClicked(ControlObject*))); connect(m_pDlgControllerLearning, SIGNAL(listenForClicks()), pControllerLearning, SLOT(startListening())); connect(m_pDlgControllerLearning, SIGNAL(stopListeningForClicks()), pControllerLearning, SLOT(stopListening())); connect(m_pDlgControllerLearning, SIGNAL(stopLearning()), this, SLOT(show())); connect(m_pDlgControllerLearning, SIGNAL(inputMappingsLearned(MidiInputMappings)), this, SLOT(midiInputMappingsLearned(MidiInputMappings))); emit(mappingStarted()); connect(m_pDlgControllerLearning, SIGNAL(stopLearning()), this, SIGNAL(mappingEnded())); }
void IsoServer_stopListening(IsoServer self) { stopListening(self); if (self->serverThread != NULL) Thread_destroy(self->serverThread); closeAllOpenClientConnections(self); /* Wait for connection threads to finish */ while (private_IsoServer_getConnectionCounter(self) > 0) Thread_sleep(10); if (DEBUG_ISO_SERVER) printf("ISO_SERVER: IsoServer_stopListening finished!\n"); }
QWidget *TcpServerListener::requestGui(QWidget *parent) { NetworkConfWidget *ncw = new(std::nothrow)NetworkConfWidget(NetworkConfWidget::TCP_SERVER,parent); if (ncw == NULL) { qFatal("Cannot allocate memory for NetworkConfWidget X{"); } ncw->setPort(port); ncw->setIP(listeningAddress); ncw->enableDecodeEncodeOption(true); connect(ncw, SIGNAL(newIp(QHostAddress)), this, SLOT(setListeningAddress(QHostAddress))); connect(ncw, SIGNAL(newPort(quint16)), this, SLOT(setPort(quint16))); connect(ncw, SIGNAL(start()), this, SLOT(startListening())); connect(ncw, SIGNAL(stop()), this, SLOT(stopListening())); connect(ncw,SIGNAL(restart()), this, SLOT(restart())); connect(this, SIGNAL(started()), ncw, SLOT(onServerStarted())); connect(this, SIGNAL(stopped()), ncw, SLOT(onServerStopped())); return ncw; }