use of eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo in project Conversations by siacs.
the class JingleFileTransferConnection method receiveFallbackToIbb.
private void receiveFallbackToIbb(final JinglePacket packet, final IbbTransportInfo transportInfo) {
if (isInitiator()) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": received out of order transport-replace (we were initiating)");
respondToIqWithOutOfOrder(packet);
return;
}
final boolean validState = mJingleStatus == JINGLE_STATUS_ACCEPTED || (proxyActivationFailed && mJingleStatus == JINGLE_STATUS_TRANSMITTING);
if (!validState) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": received out of order transport-replace");
respondToIqWithOutOfOrder(packet);
return;
}
// fallback received; now we no longer need to accept another one;
this.proxyActivationFailed = false;
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": receiving fallback to ibb");
final int remoteBlockSize = transportInfo.getBlockSize();
if (remoteBlockSize > 0) {
this.ibbBlockSize = Math.min(MAX_IBB_BLOCK_SIZE, remoteBlockSize);
} else {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to parse block size in transport-replace");
}
// TODO: handle the case where this is null by the remote party
this.transportId = transportInfo.getTransportId();
this.transport = new JingleInBandTransport(this, this.transportId, this.ibbBlockSize);
final JinglePacket answer = bootstrapPacket(JinglePacket.Action.TRANSPORT_ACCEPT);
final Content content = new Content(contentCreator, contentName);
content.setSenders(this.contentSenders);
content.setTransport(new IbbTransportInfo(this.transportId, this.ibbBlockSize));
answer.addJingleContent(content);
respondToIq(packet, true);
if (isInitiator()) {
this.sendJinglePacket(answer, (account, response) -> {
if (response.getType() == IqPacket.TYPE.RESULT) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + " recipient ACKed our transport-accept. creating ibb");
transport.connect(onIbbTransportConnected);
}
});
} else {
this.transport.receive(file, onFileTransmissionStatusChanged);
this.sendJinglePacket(answer);
}
}
use of eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo in project Conversations by siacs.
the class JingleFileTransferConnection method sendFallbackToIbb.
private void sendFallbackToIbb() {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": sending fallback to ibb");
final JinglePacket packet = this.bootstrapPacket(JinglePacket.Action.TRANSPORT_REPLACE);
final Content content = new Content(this.contentCreator, this.contentName);
content.setSenders(this.contentSenders);
this.transportId = JingleConnectionManager.nextRandomId();
content.setTransport(new IbbTransportInfo(this.transportId, this.ibbBlockSize));
packet.addJingleContent(content);
this.sendJinglePacket(packet);
}
Aggregations