void P3LeafMesh::open_i(ServiceParamsPtr& params, int fttype) throw (ServiceException&) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T) INFO: P3LeafMesh::open_i(%d)\n"), m_status)); ACE_GUARD(ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, m_lock); if (isStarting() /*|| isResuming()*/) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T) INFO: P3LeafMesh::open_i starting(%d)\n"), m_status)); //Task::activate(); int maxBindTries = 10000; //IncrementalSleep sleeper(1,0); //IncrementalSleep sleeper(0,1000); IncrementalSleep sleeper(0, DEFAULT_BIND_TIME); m_start = ACE_OS::gettimeofday(); for (int i = 0; i < maxBindTries; i++) { try { bind(true); return; } catch (ServiceException& bindEx) { //discard bindEx sleeper.sleep(); } } ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T) INFO: P3LeafMesh::open(): bind failed\n"))); throw ServiceException(ServiceException::REGISTRATION_ERROR); } else { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T) INFO: P3LeafMesh::open(): error\n"))); throw ServiceException(ServiceException::REGISTRATION_ERROR); } }
Application *LauncherModel::addApplication(const QString &appId, bool pinned) { auto app = new Application(appId, pinned, this); if (pinned && !app->isValid()) { pinLauncher(appId, false); return nullptr; } QObject::connect(app, &Application::launched, [=]() { QModelIndex modelIndex = index(indexFromAppId(appId)); emit dataChanged(modelIndex, modelIndex); QTimer::singleShot(5000, [=]() { if (app->isStarting()) { qDebug() << "Application failed to start!" << appId; auto i = indexFromAppId(appId); if (app->isPinned()) { QModelIndex modelIndex = index(i); app->setState(Application::NotRunning); emit dataChanged(modelIndex, modelIndex); } else { beginRemoveRows(QModelIndex(), i, i); m_list.takeAt(i)->deleteLater(); endRemoveRows(); } } else { qDebug() << "Application is now running" << appId; } }); }); m_list.append(app); return app; }