mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 11:42:15 -05:00
better cleanup after unsuccesful transfers
This commit is contained in:
parent
47d44448f3
commit
ca2d86cf87
@ -726,6 +726,9 @@ public class JingleConnection implements Downloadable {
|
|||||||
this.mJingleConnectionManager.finishConnection(this);
|
this.mJingleConnectionManager.finishConnection(this);
|
||||||
if (this.responder.equals(account.getJid())) {
|
if (this.responder.equals(account.getJid())) {
|
||||||
this.message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_FAILED));
|
this.message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_FAILED));
|
||||||
|
if (this.file!=null) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
this.mXmppConnectionService.updateConversationUi();
|
this.mXmppConnectionService.updateConversationUi();
|
||||||
} else {
|
} else {
|
||||||
this.mXmppConnectionService.markMessage(this.message,
|
this.mXmppConnectionService.markMessage(this.message,
|
||||||
@ -743,6 +746,9 @@ public class JingleConnection implements Downloadable {
|
|||||||
if (this.message != null) {
|
if (this.message != null) {
|
||||||
if (this.responder.equals(account.getJid())) {
|
if (this.responder.equals(account.getJid())) {
|
||||||
this.message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_FAILED));
|
this.message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_FAILED));
|
||||||
|
if (this.file!=null) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
this.mXmppConnectionService.updateConversationUi();
|
this.mXmppConnectionService.updateConversationUi();
|
||||||
} else {
|
} else {
|
||||||
this.mXmppConnectionService.markMessage(this.message,
|
this.mXmppConnectionService.markMessage(this.message,
|
||||||
|
@ -34,7 +34,7 @@ public class JingleInbandTransport extends JingleTransport {
|
|||||||
private JingleConnection connection;
|
private JingleConnection connection;
|
||||||
|
|
||||||
private InputStream fileInputStream = null;
|
private InputStream fileInputStream = null;
|
||||||
private OutputStream fileOutputStream;
|
private OutputStream fileOutputStream = null;
|
||||||
private long remainingSize = 0;
|
private long remainingSize = 0;
|
||||||
private long fileSize = 0;
|
private long fileSize = 0;
|
||||||
private MessageDigest digest;
|
private MessageDigest digest;
|
||||||
@ -129,6 +129,20 @@ public class JingleInbandTransport extends JingleTransport {
|
|||||||
@Override
|
@Override
|
||||||
public void disconnect() {
|
public void disconnect() {
|
||||||
this.connected = false;
|
this.connected = false;
|
||||||
|
if (this.fileOutputStream != null) {
|
||||||
|
try {
|
||||||
|
this.fileOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.fileInputStream != null) {
|
||||||
|
try {
|
||||||
|
this.fileInputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendNextBlock() {
|
private void sendNextBlock() {
|
||||||
|
@ -197,6 +197,20 @@ public class JingleSocks5Transport extends JingleTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect() {
|
public void disconnect() {
|
||||||
|
if (this.outputStream != null) {
|
||||||
|
try {
|
||||||
|
this.outputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.inputStream != null) {
|
||||||
|
try {
|
||||||
|
this.inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.socket != null) {
|
if (this.socket != null) {
|
||||||
try {
|
try {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user