ensure that jingle ft transport is terminated
This commit is contained in:
parent
0f50f71176
commit
a2c67a6e38
|
@ -253,6 +253,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
||||||
Throwables.getRootCause(e));
|
Throwables.getRootCause(e));
|
||||||
respondOk(jinglePacket);
|
respondOk(jinglePacket);
|
||||||
|
terminateTransport();
|
||||||
sendSessionTerminate(Reason.of(e), e.getMessage());
|
sendSessionTerminate(Reason.of(e), e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -534,6 +535,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
if (isTerminated()) {
|
if (isTerminated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
terminateTransport();
|
||||||
final Throwable rootCause = Throwables.getRootCause(throwable);
|
final Throwable rootCause = Throwables.getRootCause(throwable);
|
||||||
Log.d(Config.LOGTAG, "unable to send session accept", rootCause);
|
Log.d(Config.LOGTAG, "unable to send session accept", rootCause);
|
||||||
sendSessionTerminate(Reason.ofThrowable(rootCause), rootCause.getMessage());
|
sendSessionTerminate(Reason.ofThrowable(rootCause), rootCause.getMessage());
|
||||||
|
@ -603,6 +605,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
||||||
Throwables.getRootCause(e));
|
Throwables.getRootCause(e));
|
||||||
respondOk(jinglePacket);
|
respondOk(jinglePacket);
|
||||||
|
terminateTransport();
|
||||||
sendSessionTerminate(Reason.of(e), e.getMessage());
|
sendSessionTerminate(Reason.of(e), e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -646,6 +649,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
||||||
Throwables.getRootCause(e));
|
Throwables.getRootCause(e));
|
||||||
respondOk(jinglePacket);
|
respondOk(jinglePacket);
|
||||||
|
terminateTransport();
|
||||||
sendSessionTerminate(Reason.of(e), e.getMessage());
|
sendSessionTerminate(Reason.of(e), e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -708,6 +712,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
} else if (transportInfo
|
} else if (transportInfo
|
||||||
instanceof SocksByteStreamsTransportInfo.CandidateUsed candidateUsed) {
|
instanceof SocksByteStreamsTransportInfo.CandidateUsed candidateUsed) {
|
||||||
if (!socksBytestreamsTransport.setCandidateUsed(candidateUsed.cid)) {
|
if (!socksBytestreamsTransport.setCandidateUsed(candidateUsed.cid)) {
|
||||||
|
terminateTransport();
|
||||||
sendSessionTerminate(
|
sendSessionTerminate(
|
||||||
Reason.FAILED_TRANSPORT,
|
Reason.FAILED_TRANSPORT,
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -734,6 +739,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
id.account.getJid().asBareJid() + ": improperly formatted contents",
|
||||||
Throwables.getRootCause(e));
|
Throwables.getRootCause(e));
|
||||||
respondOk(jinglePacket);
|
respondOk(jinglePacket);
|
||||||
|
terminateTransport();
|
||||||
sendSessionTerminate(Reason.of(e), e.getMessage());
|
sendSessionTerminate(Reason.of(e), e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -843,7 +849,8 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
if (transport == null) {
|
if (transport == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO consider setting transport callback to null. requires transport to handle null callback
|
// TODO consider setting transport callback to null. requires transport to handle null
|
||||||
|
// callback
|
||||||
// transport.setTransportCallback(null);
|
// transport.setTransportCallback(null);
|
||||||
transport.terminate();
|
transport.terminate();
|
||||||
this.transport = null;
|
this.transport = null;
|
||||||
|
@ -875,9 +882,13 @@ public class JingleFileTransferConnection extends AbstractJingleConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Throwable throwable) {
|
public void onFailure(@NonNull final Throwable throwable) {
|
||||||
|
// The state transition in here should be synchronized to not race with the
|
||||||
|
// state transition in receiveSessionTerminate
|
||||||
|
synchronized (JingleFileTransferConnection.this) {
|
||||||
onFileTransmissionFailed(throwable);
|
onFileTransmissionFailed(throwable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
MoreExecutors.directExecutor());
|
MoreExecutors.directExecutor());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue