diff --git a/include/n2n.h b/include/n2n.h index e4b3b4a..9d9b1e7 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -114,10 +114,6 @@ typedef struct ether_hdr ether_hdr_t; #include #endif -#ifdef __ANDROID_NDK__ -#define ARP_PERIOD_INTERVAL (10) /* sec */ -#endif /* #ifdef __ANDROID_NDK__ */ - #include #include #include @@ -239,6 +235,9 @@ typedef struct n2n_edge_callbacks { /* Called whenever the IP address of the TAP interface changes. */ void (*ip_address_changed)(n2n_edge_t *eee, uint32_t old_ip, uint32_t new_ip); + + /* Called periodically in the main loop. */ + void (*main_loop_period)(n2n_edge_t *eee, time_t now); } n2n_edge_callbacks_t; /* ***************************************************** */ diff --git a/src/edge_utils.c b/src/edge_utils.c index 1389ab8..231ce97 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -1825,9 +1825,6 @@ int run_edge_loop(n2n_edge_t * eee, int *keep_running) { time_t lastTransop=0; time_t last_purge_known = 0; time_t last_purge_pending = 0; -#ifdef __ANDROID_NDK__ - time_t lastArpPeriod=0; -#endif #ifdef WIN32 struct tunread_arg arg; @@ -1941,12 +1938,9 @@ int run_edge_loop(n2n_edge_t * eee, int *keep_running) { eee->cb.ip_address_changed(eee, old_ip, eee->device.ip_addr); } -#ifdef __ANDROID_NDK__ - if((nowTime - lastArpPeriod) > ARP_PERIOD_INTERVAL) { - uip_arp_timer(); - lastArpPeriod = nowTime; - } -#endif /* #ifdef __ANDROID_NDK__ */ + if (eee->cb.main_loop_period) + eee->cb.main_loop_period(eee, nowTime); + } /* while */ #ifdef WIN32