Remove temporary HttpRequestPumper eventnames from mainloop eventpump

master
Nicky 2016-05-24 18:50:42 +02:00
parent 0bb62b2f8c
commit 4f99e217d3
4 changed files with 19 additions and 1 deletions

View File

@ -721,6 +721,9 @@ public:
template<typename KEY_OR_ITER>
dep_range get_before_range(const KEY_OR_ITER& key) const;
void clearCache()
{ mCache.clear(); }
private:
DepNodeMap mNodes;
mutable iterator_list mCache;

View File

@ -480,6 +480,14 @@ void LLEventPump::stopListening(const std::string& name)
// avoid a new dependency sort in such cases.
}
// <FS:ND> Allow full unregister, or mDeps will grow and grow with stale entries from temporary HttpRequestPumper instances
void LLEventPump::removeFromDeps( std::string const &a_strName )
{
mDeps.remove( a_strName );
mDeps.clearCache();
}
// </FS:ND?
/*****************************************************************************
* LLEventStream
*****************************************************************************/

View File

@ -533,6 +533,8 @@ public:
/// <tt>getListener(name).disconnect()</tt> because stopListening() also
/// forgets this name.
virtual void stopListening(const std::string& name);
void removeFromDeps( std::string const &a_strName ); // <FS:ND> Allow full unregister, or mDeps will grow and grow with stale entries from temporary HttpRequestPumper instances
/// Post an event to all listeners. The @c bool return is only meaningful
/// if the underlying leaf class is LLEventStream -- beware of relying on
/// it too much! Truthfully, we return @c bool mostly to permit chaining

View File

@ -102,6 +102,7 @@ private:
LLTempBoundListener mBoundListener;
LLCore::HttpRequest::ptr_t mHttpRequest;
std::string mEventName; // <FS:ND/> Remember event name for unregister
};
@ -641,8 +642,9 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &succes
HttpRequestPumper::HttpRequestPumper(const LLCore::HttpRequest::ptr_t &request) :
mHttpRequest(request)
{
mEventName = LLEventPump::inventName(); // <FS:ND/> Remember name for unregister
mBoundListener = LLEventPumps::instance().obtain("mainloop").
listen(LLEventPump::inventName(), boost::bind(&HttpRequestPumper::pollRequest, this, _1));
listen( mEventName, boost::bind(&HttpRequestPumper::pollRequest, this, _1));
}
HttpRequestPumper::~HttpRequestPumper()
@ -651,6 +653,9 @@ HttpRequestPumper::~HttpRequestPumper()
{
mBoundListener.disconnect();
}
LLEventPumps::instance().obtain( "mainloop" ).removeFromDeps( mEventName ); // <FS:ND> Unregister, or mDeps of mainloop pump will grow and grow with stale entries from temporary HttpRequestPumper instances
}
bool HttpRequestPumper::pollRequest(const LLSD&)