mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 13:17:43 +00:00
Hopefully fixed crash in Android 8.1
This commit is contained in:
parent
55a0ad657e
commit
f5254e504d
@ -253,7 +253,9 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
|
||||
//Handshake is blocking, so do it on another thread and free this thread to keep receiving new connection
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sslsocket.startHandshake();
|
||||
synchronized (this) {
|
||||
sslsocket.startHandshake();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("KDE/LanLinkProvider", "Handshake failed with " + identityPacket.getString("deviceName"));
|
||||
e.printStackTrace();
|
||||
@ -286,7 +288,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
|
||||
* @param connectionOrigin which side started this connection
|
||||
* @throws IOException if an exception is thrown by {@link LanLink#reset(Socket, LanLink.ConnectionStarted)}
|
||||
*/
|
||||
private synchronized void addLink(final NetworkPacket identityPacket, Socket socket, LanLink.ConnectionStarted connectionOrigin) throws IOException {
|
||||
private void addLink(final NetworkPacket identityPacket, Socket socket, LanLink.ConnectionStarted connectionOrigin) throws IOException {
|
||||
|
||||
String deviceId = identityPacket.getString("deviceId");
|
||||
LanLink currentLink = visibleComputers.get(deviceId);
|
||||
|
@ -42,6 +42,7 @@ import org.spongycastle.operator.jcajce.JcaContentSignerBuilder;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.PrivateKey;
|
||||
@ -201,7 +202,7 @@ public class SslHelper {
|
||||
|
||||
}
|
||||
|
||||
public static void configureSslSocket(SSLSocket socket, boolean isDeviceTrusted, boolean isClient) {
|
||||
public static void configureSslSocket(SSLSocket socket, boolean isDeviceTrusted, boolean isClient) throws SocketException {
|
||||
|
||||
socket.setEnabledProtocols(new String[]{"TLSv1"}); //Newer TLS versions are only supported on API 16+
|
||||
|
||||
@ -223,6 +224,8 @@ public class SslHelper {
|
||||
}
|
||||
socket.setEnabledCipherSuites(supportedCiphers.toArray(new String[supportedCiphers.size()]));
|
||||
|
||||
socket.setSoTimeout(1000);
|
||||
|
||||
if (isClient) {
|
||||
socket.setUseClientMode(true);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user