/* Reaction to a change in bitmaplist, this function finds a texture picker floater's appropriate scrolllist and passes this scrolllist's pointer to UpdateTextureCtrlList for processing. */ void LLLocalBitmapBrowser::onChangeHappened() { /* own floater update */ LLFloaterLocalBitmapBrowser::updateBitmapScrollList(); /* texturepicker related */ const LLView::child_list_t* child_list = gFloaterView->getChildList(); LLView::child_list_const_iter_t child_list_iter = child_list->begin(); for (; child_list_iter != child_list->end(); child_list_iter++) { LLView* view = *child_list_iter; if ( view->getName() == LOCAL_TEXTURE_PICKER_NAME ) { LLScrollListCtrl* ctrl = view->getChild<LLScrollListCtrl> ( LOCAL_TEXTURE_PICKER_LIST_NAME, LOCAL_TEXTURE_PICKER_RECURSE ); if ( ctrl ) { updateTextureCtrlList(ctrl); } } } /* poking timer to see if it's still needed/still not needed */ pingTimer(); }
void LLLocalBitmapBrowser::onUpdateBool(LLUUID id) { LLLocalBitmap* unit = getBitmapUnit( id ); if ( unit ) { unit->setUpdateBool(); pingTimer(); } }
void MulticastClientTransport::dropIdleTransports() { bringInNewTransports(); Lock lock(mClientTransportsMutex); bool needToRemove = false; ClientTransportList::iterator iter; for (iter = mClientTransports.begin(); iter != mClientTransports.end(); ++iter) { RCF::ClientTransport & transport = ***iter; RcfSessionWeakPtr rcfSessionWeakPtr = transport.getRcfSession(); if ( rcfSessionWeakPtr == RcfSessionWeakPtr() ) { // HTTP/HTTPS connections do not hold on to the RcfSession and can't receive pings. continue; } RcfSessionPtr rcfSessionPtr = rcfSessionWeakPtr.lock(); if (!rcfSessionPtr) { RCF_LOG_2() << "Dropping subscription. Subscriber has closed connection."; iter->reset(); needToRemove = true; } else { boost::uint32_t pingIntervalMs = rcfSessionPtr->getPingIntervalMs(); if (pingIntervalMs) { RCF::Timer pingTimer( rcfSessionPtr->getPingTimestamp() ); if (pingTimer.elapsed(5000 + 2*pingIntervalMs)) { std::string subscriberUrl = rcfSessionPtr->getClientAddress().string(); RCF_LOG_2()(subscriberUrl)(pingIntervalMs) << "Dropping subscription. Subscriber has not sent pings within the expected ping interval."; iter->reset(); needToRemove = true; } } } } if (needToRemove) { eraseRemove(mClientTransports, ClientTransportAutoPtrPtr()); } }
void SubscriptionService::harvestExpiredSubscriptions() { // Kill off subscriptions that haven't received any recent pings. Subscriptions subsToDrop; { Lock lock(mSubscriptionsMutex); Subscriptions::iterator iter; for (iter = mSubscriptions.begin(); iter != mSubscriptions.end(); ++iter) { SubscriptionPtr subPtr = iter->lock(); if (subPtr) { Subscription & sub = * subPtr; RecursiveLock lock(sub.mMutex); RcfSessionPtr sessionPtr = sub.mRcfSessionWeakPtr.lock(); if (!sessionPtr) { RCF_LOG_2()(sub.mPublisherUrl)(sub.mTopic) << "Dropping subscription. Publisher has closed connection."; subsToDrop.insert(*iter); } else if (sub.mPingsEnabled) { boost::uint32_t pingIntervalMs = sub.mPingIntervalMs; if (pingIntervalMs) { RCF::Timer pingTimer(sessionPtr->getPingTimestamp()); if (pingTimer.elapsed(5000 + 2*pingIntervalMs)) { RCF_LOG_2()(sub.mPublisherUrl)(sub.mTopic)(sub.mPingIntervalMs) << "Dropping subscription. Publisher has not sent pings."; subsToDrop.insert(*iter); } } } } } for (iter = subsToDrop.begin(); iter != subsToDrop.end(); ++iter) { mSubscriptions.erase(*iter); } } subsToDrop.clear(); }
int main(int ac, char **av, char **envp) { BinaryDir = GetFullProgDir(av[0]); if (BinaryDir[BinaryDir.length() - 1] == '.') BinaryDir = BinaryDir.substr(0, BinaryDir.length() - 2); #ifdef _WIN32 Anope::string::size_type n = BinaryDir.rfind('\\'); #else Anope::string::size_type n = BinaryDir.rfind('/'); #endif Anope::ServicesDir = BinaryDir.substr(0, n); #ifdef _WIN32 /* Clean out the module runtime directory prior to running, just in case files were left behind during a previous run */ ModuleManager::CleanupRuntimeDirectory(); OnStartup(); #endif try { /* General initialization first */ Anope::Init(ac, av); } catch (const CoreException &ex) { Anope::Logger.Log(ex.GetReason()); return -1; } try { Uplink::Connect(); } catch (const SocketException &ex) { Anope::Logger.Terminal(_("Unable to connect to uplink #{0} ({1}:{2}): {3}"), Anope::CurrentUplink + 1, Config->Uplinks[Anope::CurrentUplink].host, Config->Uplinks[Anope::CurrentUplink].port, ex.GetReason()); } /* Set up timers */ time_t last_check = Anope::CurTime; ExpireTimer expireTimer(Config->GetBlock("options")->Get<time_t>("expiretimeout", "30m")); Uplink::PingTimer pingTimer(30); /*** Main loop. ***/ while (!Anope::Quitting) { Anope::Logger.Debug2("Top of main loop"); /* Process timers */ if (Anope::CurTime - last_check >= Config->TimeoutCheck) { TimerManager::TickTimers(Anope::CurTime); last_check = Anope::CurTime; } /* Process the socket engine */ SocketEngine::Process(); if (Anope::Signal) Anope::HandleSignal(); } if (Anope::Restarting) { EventManager::Get()->Dispatch(&Event::Restart::OnRestart); } else { EventManager::Get()->Dispatch(&Event::Shutdown::OnShutdown); } if (Anope::QuitReason.empty()) Anope::QuitReason = "Terminating, reason unknown"; Anope::Logger.Log(Anope::QuitReason); delete UplinkSock; ModuleManager::UnloadAll(); SocketEngine::Shutdown(); for (Module *m; (m = ModuleManager::FindFirstOf(PROTOCOL)) != NULL;) ModuleManager::UnloadModule(m, NULL); #ifdef _WIN32 ModuleManager::CleanupRuntimeDirectory(); OnShutdown(); #endif if (Anope::Restarting) { chdir(BinaryDir.c_str()); Anope::string sbin = "./" + Anope::ServicesBin; av[0] = const_cast<char *>(sbin.c_str()); execve(Anope::ServicesBin.c_str(), av, envp); Anope::Logger.Log("Restart failed"); Anope::ReturnValue = -1; } return Anope::ReturnValue; }