disallow subsequent session-accept
This commit is contained in:
parent
c1bdda0a9b
commit
782d889cc5
|
@ -234,7 +234,6 @@ public class JingleConnection implements Transferable {
|
||||||
} else if (packet.isAction("session-accept")) {
|
} else if (packet.isAction("session-accept")) {
|
||||||
returnResult = receiveAccept(packet);
|
returnResult = receiveAccept(packet);
|
||||||
} else if (packet.isAction("session-info")) {
|
} else if (packet.isAction("session-info")) {
|
||||||
returnResult = true;
|
|
||||||
Element checksum = packet.getChecksum();
|
Element checksum = packet.getChecksum();
|
||||||
Element file = checksum == null ? null : checksum.findChild("file");
|
Element file = checksum == null ? null : checksum.findChild("file");
|
||||||
Element hash = file == null ? null : file.findChild("hash", "urn:xmpp:hashes:2");
|
Element hash = file == null ? null : file.findChild("hash", "urn:xmpp:hashes:2");
|
||||||
|
@ -378,6 +377,9 @@ public class JingleConnection implements Transferable {
|
||||||
this.initialTransport = content.hasSocks5Transport() ? Transport.SOCKS : Transport.IBB;
|
this.initialTransport = content.hasSocks5Transport() ? Transport.SOCKS : Transport.IBB;
|
||||||
this.contentName = content.getAttribute("name");
|
this.contentName = content.getAttribute("name");
|
||||||
this.transportId = content.getTransportId();
|
this.transportId = content.getTransportId();
|
||||||
|
|
||||||
|
mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null);
|
||||||
|
|
||||||
if (this.initialTransport == Transport.SOCKS) {
|
if (this.initialTransport == Transport.SOCKS) {
|
||||||
this.mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
|
this.mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
|
||||||
} else if (this.initialTransport == Transport.IBB) {
|
} else if (this.initialTransport == Transport.IBB) {
|
||||||
|
@ -392,7 +394,7 @@ public class JingleConnection implements Transferable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG, "received block size =" + receivedBlockSize);
|
Log.d(Config.LOGTAG, "received block size was null");
|
||||||
this.sendCancel();
|
this.sendCancel();
|
||||||
this.fail();
|
this.fail();
|
||||||
return;
|
return;
|
||||||
|
@ -406,8 +408,6 @@ public class JingleConnection implements Transferable {
|
||||||
}
|
}
|
||||||
this.fileOffer = content.getFileOffer(this.ftVersion);
|
this.fileOffer = content.getFileOffer(this.ftVersion);
|
||||||
|
|
||||||
mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null);
|
|
||||||
|
|
||||||
if (fileOffer != null) {
|
if (fileOffer != null) {
|
||||||
Element encrypted = fileOffer.findChild("encrypted", AxolotlService.PEP_PREFIX);
|
Element encrypted = fileOffer.findChild("encrypted", AxolotlService.PEP_PREFIX);
|
||||||
if (encrypted != null) {
|
if (encrypted != null) {
|
||||||
|
@ -637,12 +637,17 @@ public class JingleConnection implements Transferable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean receiveAccept(JinglePacket packet) {
|
private boolean receiveAccept(JinglePacket packet) {
|
||||||
|
if (this.mJingleStatus != JINGLE_STATUS_INITIATED) {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": received out of order session-accept");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.mJingleStatus = JINGLE_STATUS_ACCEPTED;
|
this.mJingleStatus = JINGLE_STATUS_ACCEPTED;
|
||||||
mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND);
|
mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND);
|
||||||
Content content = packet.getJingleContent();
|
Content content = packet.getJingleContent();
|
||||||
if (content.hasSocks5Transport()) {
|
if (content.hasSocks5Transport()) {
|
||||||
mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
|
mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
|
||||||
this.connectNextCandidate();
|
this.connectNextCandidate();
|
||||||
|
return true;
|
||||||
} else if (content.hasIbbTransport()) {
|
} else if (content.hasIbbTransport()) {
|
||||||
String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
|
String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
|
||||||
if (receivedBlockSize != null) {
|
if (receivedBlockSize != null) {
|
||||||
|
@ -653,8 +658,10 @@ public class JingleConnection implements Transferable {
|
||||||
}
|
}
|
||||||
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
||||||
this.transport.connect(onIbbTransportConnected);
|
this.transport.connect(onIbbTransportConnected);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean receiveTransportInfo(JinglePacket packet) {
|
private boolean receiveTransportInfo(JinglePacket packet) {
|
||||||
|
@ -1110,13 +1117,7 @@ public class JingleConnection implements Transferable {
|
||||||
public boolean start() {
|
public boolean start() {
|
||||||
if (account.getStatus() == Account.State.ONLINE) {
|
if (account.getStatus() == Account.State.ONLINE) {
|
||||||
if (mJingleStatus == JINGLE_STATUS_INITIATED) {
|
if (mJingleStatus == JINGLE_STATUS_INITIATED) {
|
||||||
new Thread(new Runnable() {
|
new Thread(this::sendAccept).start();
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
sendAccept();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue