android: Increase the NAT-T keepalive interval to potentially save battery life
authorTobias Brunner <tobias@strongswan.org>
Thu, 28 Apr 2016 15:06:03 +0000 (17:06 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 2 May 2016 16:38:08 +0000 (18:38 +0200)
In case this doesn't work out we could probably make it configurable.

References #1326.

src/frontends/android/app/src/main/jni/libandroidbridge/charonservice.c

index 3bed6eb..fa97089 100644 (file)
@@ -43,6 +43,7 @@
 #define ANDROID_RETRASNMIT_TRIES 3
 #define ANDROID_RETRANSMIT_TIMEOUT 2.0
 #define ANDROID_RETRANSMIT_BASE 1.4
+#define ANDROID_KEEPALIVE_INTERVAL 45
 
 typedef struct private_charonservice_t private_charonservice_t;
 
@@ -466,6 +467,9 @@ static void set_options(char *logfile)
                                        "charon.retransmit_timeout", ANDROID_RETRANSMIT_TIMEOUT);
        lib->settings->set_double(lib->settings,
                                        "charon.retransmit_base", ANDROID_RETRANSMIT_BASE);
+       /* increase NAT-T keepalive interval a bit to save battery power */
+       lib->settings->set_time(lib->settings,
+                                       "charon.keep_alive", ANDROID_KEEPALIVE_INTERVAL);
        lib->settings->set_bool(lib->settings,
                                        "charon.initiator_only", TRUE);
        lib->settings->set_bool(lib->settings,