aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
index d9f8e3ddf..e97b7f478 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
@@ -238,7 +238,6 @@ public class JingleConnection implements Transferable {
} else if (packet.isAction("session-accept")) {
returnResult = receiveAccept(packet);
} else if (packet.isAction("session-info")) {
- returnResult = true;
Element checksum = packet.getChecksum();
Element file = checksum == null ? null : checksum.findChild("file");
Element hash = file == null ? null : file.findChild("hash", "urn:xmpp:hashes:2");
@@ -382,6 +381,9 @@ public class JingleConnection implements Transferable {
this.initialTransport = content.hasSocks5Transport() ? Transport.SOCKS : Transport.IBB;
this.contentName = content.getAttribute("name");
this.transportId = content.getTransportId();
+
+ mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null);
+
if (this.initialTransport == Transport.SOCKS) {
this.mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
} else if (this.initialTransport == Transport.IBB) {
@@ -396,7 +398,7 @@ public class JingleConnection implements Transferable {
return;
}
} else {
- Log.d(Config.LOGTAG, "received block size =" + receivedBlockSize);
+ Log.d(Config.LOGTAG, "received block size was null");
this.sendCancel();
this.fail();
return;
@@ -409,9 +411,6 @@ public class JingleConnection implements Transferable {
return;
}
this.fileOffer = content.getFileOffer(this.ftVersion);
-
- mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null);
-
if (fileOffer != null) {
Element encrypted = fileOffer.findChild("encrypted", AxolotlService.PEP_PREFIX);
if (encrypted != null) {
@@ -648,12 +647,17 @@ public class JingleConnection implements Transferable {
}
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;
mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND);
Content content = packet.getJingleContent();
if (content.hasSocks5Transport()) {
mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
this.connectNextCandidate();
+ return true;
} else if (content.hasIbbTransport()) {
String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
if (receivedBlockSize != null) {
@@ -664,8 +668,10 @@ public class JingleConnection implements Transferable {
}
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
this.transport.connect(onIbbTransportConnected);
+ return true;
+ } else {
+ return false;
}
- return true;
}
private boolean receiveTransportInfo(JinglePacket packet) {
@@ -1121,13 +1127,7 @@ public class JingleConnection implements Transferable {
public boolean start() {
if (account.getStatus() == Account.State.ONLINE) {
if (mJingleStatus == JINGLE_STATUS_INITIATED) {
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- sendAccept();
- }
- }).start();
+ new Thread(this::sendAccept).start();
}
return true;
} else {