[reSIProcate] Internal Differences between DUM::applyToServerSubscriptions and DUM::applyToAllServerSubscriptions
Aron Rosenberg
arosenberg at logitech.com
Sun Jul 10 13:10:10 CDT 2011
I was thinking about adding a DUM::applyToServerSubscriptions which takes a
standard ServerSubscriptionFunctor so that it can be better thread and
object safe instead of the current templated one and noticed that the
templated DUM version is much more efficient as it uses the
existing mServerSubscriptions instead of traversing mDialogSetMap
and mDialogs...
Anybody see any issues with converting DUM::applyToAllServerSubscriptions to
just use the cached DUM::mServerSubscriptions?
Here is proposed patch (untested for know).
--- resip/dum/DialogUsageManager.cxx
+++ resip/dum/DialogUsageManager.cxx
@@ -2353,19 +2353,26 @@
}
void
+DialogUsageManager::applyToServerSubscriptions(const Data& aor, const Data&
eventType, ServerSubscriptionFunctor* functor)
+{
+ Data key = eventType + aor;
+ std::pair<ServerSubscriptions::iterator,ServerSubscriptions::iterator>
range = mServerSubscriptions.equal_range(key);
+
+ for (ServerSubscriptions::iterator i=range.first; i!=range.second; ++i)
+ {
+ ServerSubscriptionHandle h = i->second->getHandle();
+ functor->apply(h);
+ }
+}
+
+void
DialogUsageManager::applyToAllServerSubscriptions(ServerSubscriptionFunctor*
functor)
{
assert(functor);
- for (DialogSetMap::iterator it = mDialogSetMap.begin(); it !=
mDialogSetMap.end(); ++it)
+ for (ServerSubscriptions::iterator i=mServerSubscriptions.begin();
i!=mServerSubscriptions.end(); i++)
{
- for (DialogSet::DialogMap::iterator i = it->second->mDialogs.begin();
i != it->second->mDialogs.end(); ++i)
- {
- std::vector<ServerSubscriptionHandle> serverSubs =
i->second->getServerSubscriptions();
- for (std::vector<ServerSubscriptionHandle>::iterator iss =
serverSubs.begin(); iss != serverSubs.end(); ++iss)
- {
- functor->apply(*iss);
- }
- }
+ ServerSubscriptionHandle h = i->second->getHandle();
+ functor->apply(h);
}
}
--- resip/dum/DialogUsageManager.hxx
+++ resip/dum/DialogUsageManager.hxx
@@ -339,6 +339,7 @@
bool messageAvailable(void) { return mFifo.messageAvailable(); }
void applyToAllClientSubscriptions(ClientSubscriptionFunctor*);
+ void applyToServerSubscriptions(const Data& aor, const Data&
eventType, ServerSubscriptionFunctor*);
void applyToAllServerSubscriptions(ServerSubscriptionFunctor*);
/// Note: Implementations of Postable must delete the message passed
via post
-Aron
Aron Rosenberg
LifeSize, a division of Logitech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20110710/29460a36/attachment.htm>
More information about the resiprocate-devel
mailing list