more ibb fixes (include sid in transport-accept)
This commit is contained in:
parent
2706deedbd
commit
219ae65ef7
|
@ -13,13 +13,11 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
||||||
import eu.siacs.conversations.crypto.axolotl.OnMessageCreatedCallback;
|
|
||||||
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
|
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
|
@ -650,9 +648,13 @@ public class JingleConnection implements Transferable {
|
||||||
} 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) {
|
||||||
int bs = Integer.parseInt(receivedBlockSize);
|
try {
|
||||||
if (bs > this.ibbBlockSize) {
|
int bs = Integer.parseInt(receivedBlockSize);
|
||||||
this.ibbBlockSize = bs;
|
if (bs > this.ibbBlockSize) {
|
||||||
|
this.ibbBlockSize = bs;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": unable to parse block size in session-accept");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
||||||
|
@ -839,12 +841,16 @@ public class JingleConnection implements Transferable {
|
||||||
|
|
||||||
|
|
||||||
private boolean receiveFallbackToIbb(JinglePacket packet) {
|
private boolean receiveFallbackToIbb(JinglePacket packet) {
|
||||||
Log.d(Config.LOGTAG, "receiving fallack to ibb");
|
Log.d(Config.LOGTAG, "receiving fallback to ibb");
|
||||||
final String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
|
final String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
|
||||||
if (receivedBlockSize != null) {
|
if (receivedBlockSize != null) {
|
||||||
final int bs = Integer.parseInt(receivedBlockSize);
|
try {
|
||||||
if (bs < this.ibbBlockSize) {
|
final int bs = Integer.parseInt(receivedBlockSize);
|
||||||
this.ibbBlockSize = bs;
|
if (bs < this.ibbBlockSize) {
|
||||||
|
this.ibbBlockSize = bs;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": unable to parse block size in transport-replace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transportId = packet.getJingleContent().getTransportId();
|
this.transportId = packet.getJingleContent().getTransportId();
|
||||||
|
@ -853,8 +859,8 @@ public class JingleConnection implements Transferable {
|
||||||
final JinglePacket answer = bootstrapPacket("transport-accept");
|
final JinglePacket answer = bootstrapPacket("transport-accept");
|
||||||
|
|
||||||
final Content content = new Content(contentCreator, contentName);
|
final Content content = new Content(contentCreator, contentName);
|
||||||
content.setFileOffer(fileOffer, ftVersion);
|
|
||||||
content.ibbTransport().setAttribute("block-size", this.ibbBlockSize);
|
content.ibbTransport().setAttribute("block-size", this.ibbBlockSize);
|
||||||
|
content.ibbTransport().setAttribute("sid", this.transportId);
|
||||||
answer.setContent(content);
|
answer.setContent(content);
|
||||||
|
|
||||||
|
|
||||||
|
@ -877,9 +883,13 @@ public class JingleConnection implements Transferable {
|
||||||
String receivedBlockSize = packet.getJingleContent().ibbTransport()
|
String receivedBlockSize = packet.getJingleContent().ibbTransport()
|
||||||
.getAttribute("block-size");
|
.getAttribute("block-size");
|
||||||
if (receivedBlockSize != null) {
|
if (receivedBlockSize != null) {
|
||||||
int bs = Integer.parseInt(receivedBlockSize);
|
try {
|
||||||
if (bs > this.ibbBlockSize) {
|
int bs = Integer.parseInt(receivedBlockSize);
|
||||||
this.ibbBlockSize = bs;
|
if (bs < this.ibbBlockSize) {
|
||||||
|
this.ibbBlockSize = bs;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.d(Config.LOGTAG, account.getJid().asBareJid()+": unable to parse block size in transport-accept");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
||||||
|
|
|
@ -177,12 +177,10 @@ public class JingleInbandTransport extends JingleTransport {
|
||||||
this.account.getXmppConnection().sendIqPacket(iq, this.onAckReceived);
|
this.account.getXmppConnection().sendIqPacket(iq, this.onAckReceived);
|
||||||
this.account.getXmppConnection().r(); //don't fill up stanza queue too much
|
this.account.getXmppConnection().r(); //don't fill up stanza queue too much
|
||||||
this.seq++;
|
this.seq++;
|
||||||
if (this.remainingSize > 0) {
|
connection.updateProgress((int) ((((double) (this.fileSize - this.remainingSize)) / this.fileSize) * 100));
|
||||||
connection.updateProgress((int) ((((double) (this.fileSize - this.remainingSize)) / this.fileSize) * 100));
|
if (this.remainingSize <= 0) {
|
||||||
} else {
|
|
||||||
sendClose();
|
sendClose();
|
||||||
file.setSha1Sum(digest.digest());
|
file.setSha1Sum(digest.digest());
|
||||||
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": sendNextBlock() remaining size");
|
|
||||||
this.onFileTransmissionStatusChanged.onFileTransmitted(file);
|
this.onFileTransmissionStatusChanged.onFileTransmitted(file);
|
||||||
fileInputStream.close();
|
fileInputStream.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue