1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-30 02:02:06 +01:00

Fixes in Negotiations and Listeners

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7733 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-03-27 16:53:46 +00:00 committed by thiago
parent bdfec79207
commit b9b0b6134f
2 changed files with 11 additions and 21 deletions

View file

@ -124,7 +124,6 @@ public class IncomingJingleSession extends JingleSession {
} }
setMediaNeg(new MediaNegotiator(this, payloadTypes)); setMediaNeg(new MediaNegotiator(this, payloadTypes));
if (resolver.getType().equals(TransportResolver.Type.rawupd)) { if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
setTransportNeg(new TransportNegotiator.RawUdp(this, resolver)); setTransportNeg(new TransportNegotiator.RawUdp(this, resolver));
} }
@ -132,11 +131,6 @@ public class IncomingJingleSession extends JingleSession {
setTransportNeg(new TransportNegotiator.Ice(this, resolver)); setTransportNeg(new TransportNegotiator.Ice(this, resolver));
} }
updatePacketListener();
// Establish the default state
setState(accepting);
} }
/** /**
@ -161,20 +155,24 @@ public class IncomingJingleSession extends JingleSession {
* @throws XMPPException * @throws XMPPException
*/ */
public void start(JingleSessionRequest initialJingleSessionRequest) throws XMPPException { public void start(JingleSessionRequest initialJingleSessionRequest) throws XMPPException {
// Establish the default state
setState(accepting);
updatePacketListener();
Jingle packet = initialJingleSessionRequest.getJingle(); Jingle packet = initialJingleSessionRequest.getJingle();
if (packet != null) { if (packet != null) {
// Initialize the session information // Initialize the session information
setSid(packet.getSid()); setSid(packet.getSid());
sendAck(packet); respond(packet);
} }
else { else {
throw new XMPPException( throw new XMPPException(
"Session request with null Jingle packet."); "Session request with null Jingle packet.");
} }
// Set the new session state
setState(pending);
} }
/** /**
@ -183,16 +181,7 @@ public class IncomingJingleSession extends JingleSession {
* @throws XMPPException * @throws XMPPException
*/ */
public void start() throws XMPPException { public void start() throws XMPPException {
start(this.getInitialSessionRequest()); start(getInitialSessionRequest());
}
/**
* Force a call acceptance. Used to accept a hooked call.
*
* @deprecated Avoid to use this method. Not compliance.
*/
public void accept() {
setState(active);
} }
/** /**
@ -233,6 +222,8 @@ public class IncomingJingleSession extends JingleSession {
* @throws XMPPException * @throws XMPPException
*/ */
public Jingle eventInitiate(Jingle inJingle) throws XMPPException { public Jingle eventInitiate(Jingle inJingle) throws XMPPException {
// Set the new session state
setState(pending);
return super.eventInitiate(inJingle); return super.eventInitiate(inJingle);
} }

View file

@ -110,7 +110,6 @@ public class JingleMediaTest extends SmackTestCase {
IncomingJingleSession incomingJingleSession = (IncomingJingleSession) jm1.getSession(js0.getConnection().getUser()); IncomingJingleSession incomingJingleSession = (IncomingJingleSession) jm1.getSession(js0.getConnection().getUser());
incomingJingleSession.removeAllStateListeners(); incomingJingleSession.removeAllStateListeners();
incomingJingleSession.accept();
Thread.sleep(15000); Thread.sleep(15000);