Attempts to fix an incorrect removal of the presence SUBSCRIBE and NOTIFY handler upon adding such a conference handler. Reported by Damian Minkov.

cusax-fix
Lyubomir Marinov 16 years ago
parent 7729ab3b10
commit 70fd2c5e12

@ -104,7 +104,7 @@ public class EventPackageSupport
* the <code>Timer</code> support which is to execute the
* time-based tasks of the new instance
*/
public EventPackageSupport(
protected EventPackageSupport(
ProtocolProviderServiceSipImpl protocolProvider,
String eventPackage,
int subscriptionDuration,
@ -153,6 +153,18 @@ protected void addSubscription(String callId, Subscription subscription)
}
}
/**
* Gets the name of the event package this instance implements and carried
* in the Event and Allow-Events headers.
*
* @return the name of the event package this instance implements and
* carried in the Event and Allow-Events headers
*/
public final String getEventPackage()
{
return eventPackage;
}
/**
* Safely returns the <code>ServerTransaction</code> associated with a
* specific <code>RequestEvent</code> or creates a new one if the specified

@ -1790,16 +1790,40 @@ public void registerMethodProcessor(String method,
}
else
{
Class<? extends MethodProcessor> methodProcessorClass =
methodProcessor.getClass();
for (Iterator<MethodProcessor> processorIter =
processors.iterator(); processorIter.hasNext();)
/*
* Prevent the registering of multiple instances of one and the same
* OperationSet class and take only the latest registration into
* account.
*/
Iterator<MethodProcessor> processorIter = processors.iterator();
Class<? extends MethodProcessor> methodProcessorClass
= methodProcessor.getClass();
/*
* EventPackageSupport and its extenders provide a generic mechanizm
* for building support for a specific event package so allow them
* to register multiple instances of one and the same class as long
* as they are handling different event packages.
*/
String eventPackage
= (methodProcessor instanceof EventPackageSupport)
? ((EventPackageSupport) methodProcessor).getEventPackage()
: null;
while (processorIter.hasNext())
{
if (processorIter.next().getClass()
.equals(methodProcessorClass))
{
processorIter.remove();
}
MethodProcessor processor = processorIter.next();
if (!processor.getClass().equals(methodProcessorClass))
continue;
if ((eventPackage != null)
&& (processor instanceof EventPackageSupport)
&& !eventPackage
.equals(
((EventPackageSupport) processor)
.getEventPackage()))
continue;
processorIter.remove();
}
}
processors.add(methodProcessor);

Loading…
Cancel
Save