Refactoring

pull/206/head
M66B 3 years ago
parent 66be450dc9
commit 858f2038f3

@ -83,6 +83,12 @@ public class ConnectionHelper {
"SE" // Sweden
));
static {
System.loadLibrary("fairemail");
}
public static native int jni_socket_keep_alive(int fd, int seconds);
static class NetworkState {
private Boolean connected = null;
private Boolean suitable = null;

@ -149,12 +149,6 @@ public class EmailService implements AutoCloseable {
// TLS_FALLBACK_SCSV https://tools.ietf.org/html/rfc7507
// TLS_EMPTY_RENEGOTIATION_INFO_SCSV https://tools.ietf.org/html/rfc5746
static {
System.loadLibrary("fairemail");
}
private static native int jni_socket_keep_alive(int fd, int seconds);
private EmailService() {
// Prevent instantiation
}
@ -1068,7 +1062,7 @@ public class EmailService implements AutoCloseable {
Log.i("Enabling TCP keep alive");
int fd = ParcelFileDescriptor.fromSocket(socket).getFd();
int errno = jni_socket_keep_alive(fd, TCP_KEEP_ALIVE_INTERVAL);
int errno = ConnectionHelper.jni_socket_keep_alive(fd, TCP_KEEP_ALIVE_INTERVAL);
if (errno == 0)
Log.i("Enabled TCP keep alive");
else

@ -86,7 +86,7 @@ Java_eu_faircode_email_TextHelper_jni_1detect_1language(JNIEnv *env, jclass claz
extern "C"
JNIEXPORT jint JNICALL
Java_eu_faircode_email_EmailService_jni_1socket_1keep_1alive(
Java_eu_faircode_email_ConnectionHelper_jni_1socket_1keep_1alive(
JNIEnv *env, jclass clazz,
jint fd, jint seconds) {
// https://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/#setsockopt

Loading…
Cancel
Save