mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Expose InterruptedException
SMACK-632
This commit is contained in:
parent
43b99a2a85
commit
bc61527bd2
124 changed files with 977 additions and 597 deletions
|
@ -58,7 +58,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
transportNegotiators = new ArrayList<TransportNegotiator>();
|
||||
}
|
||||
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
|
||||
// First only process IQ packets that contain <content> stanzas that
|
||||
|
@ -255,7 +255,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void triggerContentEstablished() throws NotConnectedException {
|
||||
public void triggerContentEstablished() throws NotConnectedException, InterruptedException {
|
||||
|
||||
PayloadType bestCommonAudioPt = getMediaNegotiator().getBestCommonAudioPt();
|
||||
TransportCandidate bestRemoteCandidate = getTransportNegotiator().getBestRemoteCandidate();
|
||||
|
@ -268,8 +268,9 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
/**
|
||||
* Trigger a session established event.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException {
|
||||
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException {
|
||||
|
||||
// Let the session know that we've established a content/media segment.
|
||||
JingleSession session = getSession();
|
||||
|
|
|
@ -312,8 +312,9 @@ public class JingleManager implements JingleSessionListener {
|
|||
* messages
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean isServiceEnabled(XMPPConnection connection, String userID) throws XMPPException, SmackException {
|
||||
public static boolean isServiceEnabled(XMPPConnection connection, String userID) throws XMPPException, SmackException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, Jingle.NAMESPACE);
|
||||
}
|
||||
|
||||
|
|
|
@ -232,8 +232,9 @@ public abstract class JingleNegotiator {
|
|||
* @param id the ID of the response that will be sent
|
||||
* @return the new packet to send (either a Jingle or an IQ error).
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException;
|
||||
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
|
||||
|
||||
|
||||
public void start() {
|
||||
|
|
|
@ -276,8 +276,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
* the packet received
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException {
|
||||
public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
|
||||
String responseId = null;
|
||||
|
@ -344,8 +345,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
* @return the new Jingle packet to send.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
IQ response = null;
|
||||
|
||||
|
@ -397,7 +399,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
// Send section
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
public void sendPacket(IQ iq) throws NotConnectedException {
|
||||
public void sendPacket(IQ iq) throws NotConnectedException, InterruptedException {
|
||||
|
||||
if (iq instanceof Jingle) {
|
||||
|
||||
|
@ -416,8 +418,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
* @param jout
|
||||
* the Jingle packet we want to complete and send
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Jingle sendFormattedJingle(Jingle jout) throws NotConnectedException {
|
||||
public Jingle sendFormattedJingle(Jingle jout) throws NotConnectedException, InterruptedException {
|
||||
return sendFormattedJingle(null, jout);
|
||||
}
|
||||
|
||||
|
@ -431,8 +434,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
* @param jout
|
||||
* the Jingle packet we want to complete and send
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException {
|
||||
public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException, InterruptedException {
|
||||
if (jout != null) {
|
||||
if (jout.getInitiator() == null) {
|
||||
jout.setInitiator(getInitiator());
|
||||
|
@ -795,7 +799,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
public void mediaClosed(PayloadType cand) {
|
||||
}
|
||||
|
||||
public void mediaEstablished(PayloadType pt) throws NotConnectedException {
|
||||
public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException {
|
||||
if (isFullyEstablished()) {
|
||||
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
|
||||
|
||||
|
@ -816,7 +820,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
|
||||
JingleTransportListener jingleTransportListener = new JingleTransportListener() {
|
||||
|
||||
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException {
|
||||
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
||||
if (isFullyEstablished()) {
|
||||
|
||||
// Indicate that this session is active.
|
||||
|
@ -957,8 +961,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
*
|
||||
* @throws XMPPException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void terminate() throws XMPPException, NotConnectedException {
|
||||
public void terminate() throws XMPPException, NotConnectedException, InterruptedException {
|
||||
terminate("Closed Locally");
|
||||
}
|
||||
|
||||
|
@ -967,8 +972,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
*
|
||||
* @throws XMPPException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void terminate(String reason) throws XMPPException, NotConnectedException {
|
||||
public void terminate(String reason) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
if (isClosed())
|
||||
return;
|
||||
LOGGER.fine("Terminate " + reason);
|
||||
|
@ -1053,8 +1059,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
*
|
||||
* @throws IllegalStateException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void startOutgoing() throws IllegalStateException, SmackException {
|
||||
public void startOutgoing() throws IllegalStateException, SmackException, InterruptedException {
|
||||
|
||||
updatePacketListener();
|
||||
setSessionState(JingleSessionStatePending.getInstance());
|
||||
|
|
|
@ -107,8 +107,9 @@ public class JingleSessionRequest {
|
|||
* @return Returns the <b><i>IncomingJingleSession</b></i> on which the
|
||||
* negotiation can be carried out.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized JingleSession accept() throws XMPPException, SmackException {
|
||||
public synchronized JingleSession accept() throws XMPPException, SmackException, InterruptedException {
|
||||
JingleSession session = null;
|
||||
synchronized (manager) {
|
||||
session = manager.createIncomingJingleSession(this);
|
||||
|
|
|
@ -54,8 +54,9 @@ public abstract class JingleSessionState {
|
|||
/**
|
||||
* Process an incoming Jingle Packet.
|
||||
* When you look at the GoF State pattern this method roughly corresponds to example on p310: ProcessOctect().
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException;
|
||||
public abstract IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException, InterruptedException;
|
||||
|
||||
/**
|
||||
* For debugging just emit the short name of the class.
|
||||
|
|
|
@ -63,7 +63,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
|||
|
||||
}
|
||||
|
||||
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException {
|
||||
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException, InterruptedException {
|
||||
IQ response = null;
|
||||
|
||||
switch (action) {
|
||||
|
@ -88,9 +88,10 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
|||
* In the UNKNOWN state we received a <session-initiate> action.
|
||||
* This method processes that action.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
|
||||
private IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle) throws SmackException {
|
||||
private IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle) throws SmackException, InterruptedException {
|
||||
|
||||
IQ response = null;
|
||||
boolean shouldAck = true;
|
||||
|
|
|
@ -30,8 +30,9 @@ public interface JingleMediaListener extends JingleListener {
|
|||
*
|
||||
* @param pt The payload type agreed.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void mediaEstablished(PayloadType pt) throws NotConnectedException;
|
||||
public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Notification that a payload type must be cancelled
|
||||
|
|
|
@ -37,9 +37,10 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param localCandidate the local candidate where we must listen for connections
|
||||
* @param jingleSession Session that called the method
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
|
||||
TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException;
|
||||
TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Notification that the session was declined.
|
||||
|
|
|
@ -35,9 +35,10 @@ public interface JingleTransportListener extends JingleListener {
|
|||
* @param remote The transport candidate that has been used for
|
||||
* transmitting to the remote machine
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void transportEstablished(TransportCandidate local,
|
||||
TransportCandidate remote) throws NotConnectedException;
|
||||
TransportCandidate remote) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Notification that a transport must be cancelled.
|
||||
|
|
|
@ -103,8 +103,9 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
* @return the new Jingle packet to send.
|
||||
* @throws XMPPException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException {
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
IQ response = null;
|
||||
|
||||
|
@ -202,8 +203,9 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
* @param jingle
|
||||
* @return the iq
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException {
|
||||
private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
IQ response = null;
|
||||
List<PayloadType> offeredPayloads = new ArrayList<PayloadType>();
|
||||
|
||||
|
@ -477,8 +479,9 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
* @param bestPt
|
||||
* payload type that has been agreed.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void triggerMediaEstablished(PayloadType bestPt) throws NotConnectedException {
|
||||
protected void triggerMediaEstablished(PayloadType bestPt) throws NotConnectedException, InterruptedException {
|
||||
List<JingleListener> listeners = getListenersList();
|
||||
for (JingleListener li : listeners) {
|
||||
if (li instanceof JingleMediaListener) {
|
||||
|
|
|
@ -45,8 +45,9 @@ public class BasicResolver extends TransportResolver {
|
|||
* The BasicResolver takes the IP addresses of the interfaces and uses the
|
||||
* first non-loopback, non-linklocal and non-sitelocal address.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
|
||||
setResolveInit();
|
||||
|
||||
|
|
|
@ -60,8 +60,9 @@ public class BridgedResolver extends TransportResolver {
|
|||
* <p/>
|
||||
* The BridgedResolver takes the IP addresse and ports of a jmf proxy service.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
|
||||
setResolveInit();
|
||||
|
||||
|
@ -98,7 +99,7 @@ public class BridgedResolver extends TransportResolver {
|
|||
setResolveEnd();
|
||||
}
|
||||
|
||||
public void initialize() throws SmackException, XMPPErrorException {
|
||||
public void initialize() throws SmackException, XMPPErrorException, InterruptedException {
|
||||
|
||||
clearCandidates();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class BridgedTransportManager extends JingleTransportManager implements J
|
|||
|
||||
// Implement a Session Listener to relay candidates after establishment
|
||||
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException {
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
|
||||
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,9 @@ public class FixedResolver extends TransportResolver {
|
|||
/**
|
||||
* Resolve the IP address.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
if (!isResolving()) {
|
||||
setResolveInit();
|
||||
|
||||
|
|
|
@ -91,8 +91,9 @@ public class ICEResolver extends TransportResolver {
|
|||
/**
|
||||
* Resolve the IP and obtain a valid transport method.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, SmackException {
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException {
|
||||
this.setResolveInit();
|
||||
|
||||
for (TransportCandidate candidate : this.getCandidatesList()) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
|
|||
}
|
||||
}
|
||||
|
||||
protected TransportResolver createResolver(JingleSession session) throws SmackException {
|
||||
protected TransportResolver createResolver(JingleSession session) throws SmackException, InterruptedException {
|
||||
try {
|
||||
iceResolver.resolve(session);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
|
|||
|
||||
// Implement a Session Listener to relay candidates after establishment
|
||||
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException {
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
|
||||
if (lc instanceof ICECandidate) {
|
||||
if (((ICECandidate) lc).getType().equals("relay")) {
|
||||
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
|
||||
|
|
|
@ -51,8 +51,9 @@ public abstract class JingleTransportManager {
|
|||
* Get a new Transport Resolver to be used in a Jingle Session
|
||||
*
|
||||
* @return the TransportResolver to be used
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public TransportResolver getResolver(JingleSession session) throws XMPPException, SmackException {
|
||||
public TransportResolver getResolver(JingleSession session) throws XMPPException, SmackException, InterruptedException {
|
||||
TransportResolver resolver = createResolver(session);
|
||||
if (resolver == null) {
|
||||
resolver = new BasicResolver();
|
||||
|
@ -66,7 +67,8 @@ public abstract class JingleTransportManager {
|
|||
* Create a Transport Resolver instance according to the implementation.
|
||||
*
|
||||
* @return the TransportResolver
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected abstract TransportResolver createResolver(JingleSession session) throws SmackException;
|
||||
protected abstract TransportResolver createResolver(JingleSession session) throws SmackException, InterruptedException;
|
||||
|
||||
}
|
||||
|
|
|
@ -389,8 +389,9 @@ public class RTPBridge extends IQ {
|
|||
* @param sessionID
|
||||
* @return the new RTPBridge
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException {
|
||||
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return null;
|
||||
|
@ -417,9 +418,10 @@ public class RTPBridge extends IQ {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean serviceAvailable(XMPPConnection connection) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException {
|
||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return false;
|
||||
|
@ -454,8 +456,9 @@ public class RTPBridge extends IQ {
|
|||
* @param connection
|
||||
* @return the RTPBridge
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException {
|
||||
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return null;
|
||||
|
@ -489,8 +492,9 @@ public class RTPBridge extends IQ {
|
|||
* @param xmppConnection
|
||||
* @return public IP String or null if not found
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException {
|
||||
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException {
|
||||
|
||||
if (!xmppConnection.isConnected()) {
|
||||
return null;
|
||||
|
|
|
@ -173,8 +173,9 @@ public class STUN extends SimpleIQ {
|
|||
* @param connection
|
||||
* @return the STUN server address
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException {
|
||||
public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return null;
|
||||
|
@ -200,8 +201,9 @@ public class STUN extends SimpleIQ {
|
|||
* @return true if the server support STUN
|
||||
* @throws SmackException
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean serviceAvailable(XMPPConnection connection) throws XMPPException, SmackException {
|
||||
public static boolean serviceAvailable(XMPPConnection connection) throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return false;
|
||||
|
|
|
@ -264,8 +264,9 @@ public class STUNResolver extends TransportResolver {
|
|||
/**
|
||||
* Resolve the IP and obtain a valid transport method.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
|
||||
setResolveInit();
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
try {
|
||||
js.sendFormattedJingle(jin, jout);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
acceptedRemoteCandidates.add(bestRemote);
|
||||
|
@ -333,7 +333,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
try {
|
||||
triggerTransportEstablished(getAcceptedLocalCandidate(), bestRemote);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
break;
|
||||
|
@ -414,7 +414,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
try {
|
||||
js.sendFormattedJingle(jin, jout);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
acceptedRemoteCandidates.add(bestRemote);
|
||||
|
@ -525,8 +525,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
*
|
||||
* @param cand
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException {
|
||||
private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException, InterruptedException {
|
||||
if (!cand.isNull()) {
|
||||
// Offer our new candidate...
|
||||
addOfferedCandidate(cand);
|
||||
|
@ -547,8 +548,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
*
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void sendTransportCandidatesOffer() throws XMPPException, SmackException {
|
||||
private void sendTransportCandidatesOffer() throws XMPPException, SmackException, InterruptedException {
|
||||
List<TransportCandidate> notOffered = resolver.getCandidatesList();
|
||||
|
||||
notOffered.removeAll(offeredCandidates);
|
||||
|
@ -562,7 +564,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
if (resolverListener == null) {
|
||||
// Add a listener that sends the offer when the resolver finishes...
|
||||
resolverListener = new TransportResolverListener.Resolver() {
|
||||
public void candidateAdded(TransportCandidate cand) throws NotConnectedException {
|
||||
public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
|
||||
sendTransportCandidateOffer(cand);
|
||||
}
|
||||
|
||||
|
@ -592,8 +594,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
* @return the new Jingle packet to send.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public final List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
|
||||
public final List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
IQ response = null;
|
||||
|
||||
|
@ -662,8 +665,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
* @return an IQ packet
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private Jingle receiveResult(IQ iq) throws XMPPException, SmackException {
|
||||
private Jingle receiveResult(IQ iq) throws XMPPException, SmackException, InterruptedException {
|
||||
Jingle response = null;
|
||||
|
||||
sendTransportCandidatesOffer();
|
||||
|
@ -677,8 +681,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
* @param jingleTransport
|
||||
* @return the iq
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private IQ receiveSessionInitiateAction(Jingle jingle) throws XMPPException, SmackException {
|
||||
private IQ receiveSessionInitiateAction(Jingle jingle) throws XMPPException, SmackException, InterruptedException {
|
||||
IQ response = null;
|
||||
|
||||
// Parse the Jingle and get any proposed transport candidates
|
||||
|
@ -781,8 +786,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
* @param local TransportCandidate that has been agreed.
|
||||
* @param remote TransportCandidate that has been agreed.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException {
|
||||
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
||||
List<JingleListener> listeners = getListenersList();
|
||||
for (JingleListener li : listeners) {
|
||||
if (li instanceof JingleTransportListener) {
|
||||
|
|
|
@ -88,13 +88,15 @@ public abstract class TransportResolver {
|
|||
|
||||
/**
|
||||
* Initialize the Resolver
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void initialize() throws XMPPException, SmackException;
|
||||
public abstract void initialize() throws XMPPException, SmackException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Start a the resolution.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void resolve(JingleSession session) throws XMPPException, SmackException;
|
||||
public abstract void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Clear the list of candidates and start a new resolution process.
|
||||
|
@ -208,8 +210,9 @@ public abstract class TransportResolver {
|
|||
*
|
||||
* @param cand The candidate added to the list of candidates.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void triggerCandidateAdded(TransportCandidate cand) throws NotConnectedException {
|
||||
protected void triggerCandidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
|
||||
Iterator<TransportResolverListener> iter = getListenersList().iterator();
|
||||
while (iter.hasNext()) {
|
||||
TransportResolverListener trl = iter.next();
|
||||
|
@ -265,8 +268,9 @@ public abstract class TransportResolver {
|
|||
*
|
||||
* @param cand The candidate to add
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void addCandidate(TransportCandidate cand) throws NotConnectedException {
|
||||
protected void addCandidate(TransportCandidate cand) throws NotConnectedException, InterruptedException {
|
||||
synchronized (candidates) {
|
||||
if (!candidates.contains(cand))
|
||||
candidates.add(cand);
|
||||
|
@ -355,8 +359,9 @@ public abstract class TransportResolver {
|
|||
/**
|
||||
* Initialize Transport Resolver and wait until it is complete unitialized.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void initializeAndWait() throws XMPPException, SmackException {
|
||||
public void initializeAndWait() throws XMPPException, SmackException, InterruptedException {
|
||||
this.initialize();
|
||||
try {
|
||||
LOGGER.fine("Initializing transport resolver...");
|
||||
|
|
|
@ -36,8 +36,9 @@ public abstract interface TransportResolverListener {
|
|||
*
|
||||
* @param cand The transport candidate.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void candidateAdded(TransportCandidate cand) throws NotConnectedException;
|
||||
public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* All the transport candidates have been obtained.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue