added timeout to jingle socket
This commit is contained in:
parent
f33d2497f8
commit
363682065d
|
@ -99,6 +99,7 @@ public class JingleConnection {
|
|||
|
||||
@Override
|
||||
public void onFileTransferAborted() {
|
||||
JingleConnection.this.sendCancel();
|
||||
JingleConnection.this.cancel();
|
||||
}
|
||||
};
|
||||
|
@ -280,16 +281,26 @@ public class JingleConnection {
|
|||
}
|
||||
this.file = this.mXmppConnectionService.getFileBackend().getJingleFile(message,false);
|
||||
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||
byte[] key = conversation.getSymmetricKey();
|
||||
if (key==null) {
|
||||
this.sendCancel();
|
||||
this.cancel();
|
||||
return;
|
||||
} else {
|
||||
this.file.setKey(conversation.getSymmetricKey());
|
||||
}
|
||||
}
|
||||
this.file.setExpectedSize(size);
|
||||
} else {
|
||||
this.sendCancel();
|
||||
this.cancel();
|
||||
}
|
||||
} else {
|
||||
this.sendCancel();
|
||||
this.cancel();
|
||||
}
|
||||
} else {
|
||||
this.sendCancel();
|
||||
this.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -410,6 +421,7 @@ public class JingleConnection {
|
|||
connection.setActivated(true);
|
||||
} else {
|
||||
Log.d("xmppService","activated connection not found");
|
||||
this.sendCancel();
|
||||
this.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -603,8 +615,7 @@ public class JingleConnection {
|
|||
this.mJingleConnectionManager.finishConnection(this);
|
||||
}
|
||||
|
||||
void cancel() {
|
||||
this.sendCancel();
|
||||
public void cancel() {
|
||||
this.disconnect();
|
||||
if (this.message!=null) {
|
||||
if (this.responder.equals(account.getFullJid())) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -137,6 +138,7 @@ public class JingleSocks5Transport extends JingleTransport {
|
|||
MessageDigest digest = MessageDigest.getInstance("SHA-1");
|
||||
digest.reset();
|
||||
inputStream.skip(45);
|
||||
socket.setSoTimeout(30000);
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
OutputStream fileOutputStream = getOutputStream(file);
|
||||
|
|
Loading…
Reference in New Issue