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) -> {
|
private OnIqPacketReceived responseListener = (account, packet) -> {
|
||||||
if (packet.getType() != IqPacket.TYPE.RESULT) {
|
if (packet.getType() != IqPacket.TYPE.RESULT) {
|
||||||
|
if (mJingleStatus != JINGLE_STATUS_FAILED && mJingleStatus != JINGLE_STATUS_FINISHED) {
|
||||||
fail(IqParser.extractErrorMessage(packet));
|
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];
|
private byte[] expectedHash = new byte[0];
|
||||||
|
@ -674,7 +678,7 @@ public class JingleConnection implements Transferable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAcceptIbb() {
|
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 JinglePacket packet = bootstrapPacket("session-accept");
|
||||||
final Content content = new Content(contentCreator, contentName);
|
final Content content = new Content(contentCreator, contentName);
|
||||||
content.setFileOffer(fileOffer, ftVersion);
|
content.setFileOffer(fileOffer, ftVersion);
|
||||||
|
@ -734,7 +738,7 @@ public class JingleConnection implements Transferable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
respondToIq(packet, true);
|
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);
|
this.transport.connect(onIbbTransportConnected);
|
||||||
} else {
|
} else {
|
||||||
respondToIq(packet, false);
|
respondToIq(packet, false);
|
||||||
|
@ -943,7 +947,7 @@ public class JingleConnection implements Transferable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transportId = packet.getJingleContent().getTransportId();
|
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");
|
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");
|
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)) {
|
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));
|
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.mJingleStatus = JINGLE_STATUS_FINISHED;
|
||||||
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_SEND_RECEIVED);
|
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_SEND_RECEIVED);
|
||||||
this.disconnectSocks5Connections();
|
this.disconnectSocks5Connections();
|
||||||
if (this.transport instanceof JingleInbandTransport) {
|
if (this.transport instanceof JingleInBandTransport) {
|
||||||
this.transport.disconnect();
|
this.transport.disconnect();
|
||||||
}
|
}
|
||||||
this.message.setTransferable(null);
|
this.message.setTransferable(null);
|
||||||
|
@ -1033,7 +1037,7 @@ public class JingleConnection implements Transferable {
|
||||||
|
|
||||||
void abort(final String reason) {
|
void abort(final String reason) {
|
||||||
this.disconnectSocks5Connections();
|
this.disconnectSocks5Connections();
|
||||||
if (this.transport instanceof JingleInbandTransport) {
|
if (this.transport instanceof JingleInBandTransport) {
|
||||||
this.transport.disconnect();
|
this.transport.disconnect();
|
||||||
}
|
}
|
||||||
sendSessionTerminate(reason);
|
sendSessionTerminate(reason);
|
||||||
|
@ -1057,7 +1061,7 @@ public class JingleConnection implements Transferable {
|
||||||
private void fail(String errorMessage) {
|
private void fail(String errorMessage) {
|
||||||
this.mJingleStatus = JINGLE_STATUS_FAILED;
|
this.mJingleStatus = JINGLE_STATUS_FAILED;
|
||||||
this.disconnectSocks5Connections();
|
this.disconnectSocks5Connections();
|
||||||
if (this.transport instanceof JingleInbandTransport) {
|
if (this.transport instanceof JingleInBandTransport) {
|
||||||
this.transport.disconnect();
|
this.transport.disconnect();
|
||||||
}
|
}
|
||||||
FileBackend.close(mFileInputStream);
|
FileBackend.close(mFileInputStream);
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log.d(Config.LOGTAG, "unable to route jingle packet: " + packet);
|
||||||
IqPacket response = packet.generateResponse(IqPacket.TYPE.ERROR);
|
IqPacket response = packet.generateResponse(IqPacket.TYPE.ERROR);
|
||||||
Element error = response.addChild("error");
|
Element error = response.addChild("error");
|
||||||
error.setAttribute("type", "cancel");
|
error.setAttribute("type", "cancel");
|
||||||
|
@ -150,17 +151,16 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
if (connection.getAccount() == account
|
if (connection.getAccount() == account
|
||||||
&& connection.hasTransportId(sid)) {
|
&& connection.hasTransportId(sid)) {
|
||||||
JingleTransport transport = connection.getTransport();
|
JingleTransport transport = connection.getTransport();
|
||||||
if (transport instanceof JingleInbandTransport) {
|
if (transport instanceof JingleInBandTransport) {
|
||||||
JingleInbandTransport inbandTransport = (JingleInbandTransport) transport;
|
JingleInBandTransport inbandTransport = (JingleInBandTransport) transport;
|
||||||
inbandTransport.deliverPayload(packet, payload);
|
inbandTransport.deliverPayload(packet, payload);
|
||||||
return;
|
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() {
|
public void cancelInTransmission() {
|
||||||
|
|
|
@ -20,20 +20,20 @@ import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
import rocks.xmpp.addr.Jid;
|
import rocks.xmpp.addr.Jid;
|
||||||
|
|
||||||
public class JingleInbandTransport extends JingleTransport {
|
public class JingleInBandTransport extends JingleTransport {
|
||||||
|
|
||||||
private Account account;
|
private final Account account;
|
||||||
private Jid counterpart;
|
private final Jid counterpart;
|
||||||
private int blockSize;
|
private final int blockSize;
|
||||||
private int seq = 0;
|
private int seq = 0;
|
||||||
private String sessionId;
|
private final String sessionId;
|
||||||
|
|
||||||
private boolean established = false;
|
private boolean established = false;
|
||||||
|
|
||||||
private boolean connected = true;
|
private boolean connected = true;
|
||||||
|
|
||||||
private DownloadableFile file;
|
private DownloadableFile file;
|
||||||
private JingleConnection connection;
|
private final JingleConnection connection;
|
||||||
|
|
||||||
private InputStream fileInputStream = null;
|
private InputStream fileInputStream = null;
|
||||||
private InputStream innerInputStream = 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.connection = connection;
|
||||||
this.account = connection.getAccount();
|
this.account = connection.getAccount();
|
||||||
this.counterpart = connection.getCounterPart();
|
this.counterpart = connection.getCounterPart();
|
||||||
this.blockSize = blocksize;
|
this.blockSize = blockSize;
|
||||||
this.sessionId = sid;
|
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 (payload.getName().equals("open")) {
|
||||||
if (!established) {
|
if (!established) {
|
||||||
established = true;
|
established = true;
|
||||||
|
|
Loading…
Reference in New Issue