bool EtherIPC::closeApp() { fClosingApp = true; fTimer.stop(); if ( fSocket.state() == QLocalSocket::UnconnectedState ) { return true; } if ( fSocket.state() == QLocalSocket::ConnectedState && getBusy() ) { // wait for operation first if we're still connected return false; } if ( fSocket.state() == QLocalSocket::ConnectedState && fFilterID >= 0 ) { // remove filter if still connected uninstallFilter(); return false; } if ( fSocket.state() != QLocalSocket::UnconnectedState ) { // wait for clean disconnect fActiveRequest = RequestIPC(Full); fSocket.disconnectFromServer(); return false; } return true; }
void EtherIPC::handleGetSyncing() { QJsonValue jv; if ( !readReply(jv) ) { return bail(); } if ( jv.isNull() || ( jv.isBool() && !jv.toBool(false) ) ) { if ( fSyncing ) { fSyncing = false; if ( fBlockFilterID.isEmpty() ) { newBlockFilter(); } emit syncingChanged(fSyncing); } return done(); } const QJsonObject syncing = jv.toObject(); fCurrentBlock = Helpers::toQUInt64(syncing.value("currentBlock")); fHighestBlock = Helpers::toQUInt64(syncing.value("highestBlock")); fStartingBlock = Helpers::toQUInt64(syncing.value("startingBlock")); if ( !fSyncing ) { if ( !fBlockFilterID.isEmpty() ) { uninstallFilter(fBlockFilterID); fBlockFilterID.clear(); } fSyncing = true; } emit syncingChanged(fSyncing); done(); }
bool FilterManager::uninstallFilter(Filter *filter) { DPTR_D(FilterManager); QMap<AVPlayer*, QList<Filter*> > map1(d.vfilter_player_map); // NB: copy it for iteration because called code may modify map -- which caused crashes QMap<AVPlayer*, QList<Filter*> >::iterator it = map1.begin(); while (it != map1.end()) { if (uninstallVideoFilter(filter, it.key())) return true; ++it; } QMap<AVPlayer *, QList<Filter *> > map2(d.afilter_player_map); // copy to avoid crashes when called-code modifies map it = map2.begin(); while (it != map2.end()) { if (uninstallAudioFilter(filter, it.key())) return true; ++it; } QMap<AVOutput*, QList<Filter*> > map3(d.filter_out_map); // copy to avoid crashes QMap<AVOutput*, QList<Filter*> >::iterator it2 = map3.begin(); while (it2 != map3.end()) { if (uninstallFilter(filter, it2.key())) return true; ++it2; } return false; }
bool FilterManager::releaseFilter(Filter *filter) { DPTR_D(FilterManager); d.pending_release_filters.push_back(filter); // will delete filter in slot onUninstallInTargetDone()(signal emitted when uninstall task done) return uninstallFilter(filter) || releaseFilterNow(filter); }
void EtherIPC::registerEventFilters(const QStringList& addresses, const QStringList& topics) { if ( !fEventFilterID.isEmpty() ) { uninstallFilter(fEventFilterID); fEventFilterID.clear(); } if ( addresses.length() > 0 ) { newEventFilter(addresses, topics); } }
bool EtherIPC::closeApp() { EtherLog::logMsg("Closing etherwall"); fClosingApp = true; fTimer.stop(); emit closingChanged(true); if ( fSocket.state() == QLocalSocket::ConnectedState && getBusy() ) { // wait for operation first if we're still connected return false; } if ( fSocket.state() == QLocalSocket::ConnectedState ) { bool removed = false; if ( !fBlockFilterID.isEmpty() ) { // remove block filter if still connected uninstallFilter(fBlockFilterID); fBlockFilterID.clear(); removed = true; } if ( !fEventFilterID.isEmpty() ) { // remove event filter if still connected uninstallFilter(fEventFilterID); fEventFilterID.clear(); removed = true; } if ( removed ) { return false; } } if ( fSocket.state() != QLocalSocket::UnconnectedState ) { // wait for clean disconnect fActiveRequest = RequestIPC(Full); fSocket.disconnectFromServer(); return false; } return killGeth(); }