aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorSebastien Mazy <sebastien@mazy.eu>2008-12-12 21:06:08 +0000
committerSebastien Mazy <sebastien@mazy.eu>2008-12-12 21:06:08 +0000
commit974151c18cf4c49b6b074fce749bd1c06b31aa39 (patch)
tree8dee6ec3bb27bc3baf475ec384a1eff9c3a9ded5 /src/net/java
parent8de7b22bf7b3f28912608e342015b1e8a8eb10cb (diff)
downloadjitsi-974151c18cf4c49b6b074fce749bd1c06b31aa39.zip
jitsi-974151c18cf4c49b6b074fce749bd1c06b31aa39.tar.gz
jitsi-974151c18cf4c49b6b074fce749bd1c06b31aa39.tar.bz2
dispatches SIP msg to SIP protocol providers until their unregistration
see ML thread: https://sip-communicator.dev.java.net/servlets/BrowseList?list=dev&by=thread&from=1465466
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java31
2 files changed, 22 insertions, 11 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
index cc99d26..84653e4 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
@@ -334,8 +334,6 @@ public class ProtocolProviderServiceSipImpl
sipRegistrarConnection.unregister();
sipSecurityManager.setSecurityAuthority(null);
-
- sipStackSharing.removeSipListener(this);
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java b/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java
index 8760342..47febcc 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java
@@ -14,6 +14,7 @@ import javax.sip.header.*;
import javax.sip.message.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
/**
@@ -30,7 +31,8 @@ import net.java.sip.communicator.util.*;
* @author Sebastien Mazy
*/
public class SipStackSharing
- implements SipListener
+ implements SipListener,
+ RegistrationStateChangeListener
{
/**
* Logger for this class
@@ -121,6 +123,7 @@ public class SipStackSharing
if(this.listeners.size() == 0)
startListening();
this.listeners.add(listener);
+ listener.addRegistrationStateChangeListener(this);
logger.trace(this.listeners.size() + " listeners now");
}
}
@@ -131,8 +134,7 @@ public class SipStackSharing
*
* @param listener possible target to remove for the dispatching process
*/
- public void removeSipListener(ProtocolProviderServiceSipImpl listener)
- throws OperationFailedException
+ private void removeSipListener(ProtocolProviderServiceSipImpl listener)
{
synchronized(this.listeners)
{
@@ -159,6 +161,23 @@ public class SipStackSharing
}
/**
+ * Stops dispatching SIP messages to a SIP protocol provider service
+ * once it's been unregistered.
+ *
+ * @param event the change event in the registration state of a provider
+ */
+ public void registrationStateChanged(RegistrationStateChangeEvent event)
+ {
+ if(event.getNewState() == RegistrationState.UNREGISTERED)
+ {
+ ProtocolProviderServiceSipImpl listener
+ = (ProtocolProviderServiceSipImpl) event.getProvider();
+ this.removeSipListener(listener);
+ listener.removeRegistrationStateChangeListener(this);
+ }
+ }
+
+ /**
* Returns the JAIN-SIP ListeningPoint associated to the given
* transport string.
*
@@ -315,7 +334,6 @@ public class SipStackSharing
* and frees the network ports used.
*/
private void stopListening()
- throws OperationFailedException
{
try
{
@@ -339,11 +357,6 @@ public class SipStackSharing
catch(ObjectInUseException ex)
{
logger.fatal("Failed to stop listening", ex);
- throw new OperationFailedException(
- "A unexpected error occurred while stopping "
- +"the SIP listening."
- , OperationFailedException.INTERNAL_ERROR
- , ex);
}
}