fixups for last commit
This commit is contained in:
parent
8263fb73e9
commit
a3d639747a
|
@ -95,7 +95,11 @@ public class JingleConnection implements Transferable {
|
|||
|
||||
private OnIqPacketReceived responseListener = (account, packet) -> {
|
||||
if (packet.getType() != IqPacket.TYPE.RESULT) {
|
||||
if (mJingleStatus != JINGLE_STATUS_FAILED && mJingleStatus != JINGLE_STATUS_FINISHED) {
|
||||
fail(IqParser.extractErrorMessage(packet));
|
||||
} else {
|
||||
Log.d(Config.LOGTAG,"ignoring late delivery of jingle packet to jingle session with status="+mJingleStatus+": "+packet.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
private byte[] expectedHash = new byte[0];
|
||||
|
@ -674,7 +678,7 @@ public class JingleConnection implements Transferable {
|
|||
}
|
||||
|
||||
private void sendAcceptIbb() {
|
||||
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
||||
this.transport = new JingleInBandTransport(this, this.transportId, this.ibbBlockSize);
|
||||
final JinglePacket packet = bootstrapPacket("session-accept");
|
||||
final Content content = new Content(contentCreator, contentName);
|
||||
content.setFileOffer(fileOffer, ftVersion);
|
||||
|
@ -734,7 +738,7 @@ public class JingleConnection implements Transferable {
|
|||
}
|
||||
}
|
||||
respondToIq(packet, true);
|
||||
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
||||
this.transport = new JingleInBandTransport(this, this.transportId, this.ibbBlockSize);
|
||||
this.transport.connect(onIbbTransportConnected);
|
||||
} else {
|
||||
respondToIq(packet, false);
|
||||
|
@ -943,7 +947,7 @@ public class JingleConnection implements Transferable {
|
|||
}
|
||||
}
|
||||
this.transportId = packet.getJingleContent().getTransportId();
|
||||
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
|
||||
this.transport = new JingleInBandTransport(this, this.transportId, this.ibbBlockSize);
|
||||
|
||||
final JinglePacket answer = bootstrapPacket("transport-accept");
|
||||
|
||||
|
@ -994,7 +998,7 @@ public class JingleConnection implements Transferable {
|
|||
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);
|
||||
|
||||
if (sid == null || !sid.equals(this.transportId)) {
|
||||
Log.w(Config.LOGTAG, String.format("%s: sid in transport-accept (%s) did not match our sid (%s) ", account.getJid().asBareJid(), sid, transportId));
|
||||
|
@ -1015,7 +1019,7 @@ public class JingleConnection implements Transferable {
|
|||
this.mJingleStatus = JINGLE_STATUS_FINISHED;
|
||||
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_SEND_RECEIVED);
|
||||
this.disconnectSocks5Connections();
|
||||
if (this.transport instanceof JingleInbandTransport) {
|
||||
if (this.transport instanceof JingleInBandTransport) {
|
||||
this.transport.disconnect();
|
||||
}
|
||||
this.message.setTransferable(null);
|
||||
|
@ -1033,7 +1037,7 @@ public class JingleConnection implements Transferable {
|
|||
|
||||
void abort(final String reason) {
|
||||
this.disconnectSocks5Connections();
|
||||
if (this.transport instanceof JingleInbandTransport) {
|
||||
if (this.transport instanceof JingleInBandTransport) {
|
||||
this.transport.disconnect();
|
||||
}
|
||||
sendSessionTerminate(reason);
|
||||
|
@ -1057,7 +1061,7 @@ public class JingleConnection implements Transferable {
|
|||
private void fail(String errorMessage) {
|
||||
this.mJingleStatus = JINGLE_STATUS_FAILED;
|
||||
this.disconnectSocks5Connections();
|
||||
if (this.transport instanceof JingleInbandTransport) {
|
||||
if (this.transport instanceof JingleInBandTransport) {
|
||||
this.transport.disconnect();
|
||||
}
|
||||
FileBackend.close(mFileInputStream);
|
||||
|
|
|
@ -49,6 +49,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
|||
return;
|
||||
}
|
||||
}
|
||||
Log.d(Config.LOGTAG, "unable to route jingle packet: " + packet);
|
||||
IqPacket response = packet.generateResponse(IqPacket.TYPE.ERROR);
|
||||
Element error = response.addChild("error");
|
||||
error.setAttribute("type", "cancel");
|
||||
|
@ -150,17 +151,16 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
|||
if (connection.getAccount() == account
|
||||
&& connection.hasTransportId(sid)) {
|
||||
JingleTransport transport = connection.getTransport();
|
||||
if (transport instanceof JingleInbandTransport) {
|
||||
JingleInbandTransport inbandTransport = (JingleInbandTransport) transport;
|
||||
if (transport instanceof JingleInBandTransport) {
|
||||
JingleInBandTransport inbandTransport = (JingleInBandTransport) transport;
|
||||
inbandTransport.deliverPayload(packet, payload);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d(Config.LOGTAG,"couldn't deliver payload: " + payload.toString());
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, "no sid found in incoming ibb packet");
|
||||
}
|
||||
Log.d(Config.LOGTAG, "unable to deliver ibb packet: " + packet.toString());
|
||||
account.getXmppConnection().sendIqPacket(packet.generateResponse(IqPacket.TYPE.ERROR), null);
|
||||
}
|
||||
|
||||
public void cancelInTransmission() {
|
||||
|
|
|
@ -20,20 +20,20 @@ import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
|||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||
import rocks.xmpp.addr.Jid;
|
||||
|
||||
public class JingleInbandTransport extends JingleTransport {
|
||||
public class JingleInBandTransport extends JingleTransport {
|
||||
|
||||
private Account account;
|
||||
private Jid counterpart;
|
||||
private int blockSize;
|
||||
private final Account account;
|
||||
private final Jid counterpart;
|
||||
private final int blockSize;
|
||||
private int seq = 0;
|
||||
private String sessionId;
|
||||
private final String sessionId;
|
||||
|
||||
private boolean established = false;
|
||||
|
||||
private boolean connected = true;
|
||||
|
||||
private DownloadableFile file;
|
||||
private JingleConnection connection;
|
||||
private final JingleConnection connection;
|
||||
|
||||
private InputStream fileInputStream = null;
|
||||
private InputStream innerInputStream = null;
|
||||
|
@ -60,11 +60,11 @@ public class JingleInbandTransport extends JingleTransport {
|
|||
}
|
||||
};
|
||||
|
||||
public JingleInbandTransport(final JingleConnection connection, final String sid, final int blocksize) {
|
||||
JingleInBandTransport(final JingleConnection connection, final String sid, final int blockSize) {
|
||||
this.connection = connection;
|
||||
this.account = connection.getAccount();
|
||||
this.counterpart = connection.getCounterPart();
|
||||
this.blockSize = blocksize;
|
||||
this.blockSize = blockSize;
|
||||
this.sessionId = sid;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class JingleInbandTransport extends JingleTransport {
|
|||
}
|
||||
}
|
||||
|
||||
public void deliverPayload(IqPacket packet, Element payload) {
|
||||
void deliverPayload(IqPacket packet, Element payload) {
|
||||
if (payload.getName().equals("open")) {
|
||||
if (!established) {
|
||||
established = true;
|
||||
|
|
Loading…
Reference in a new issue