X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink.c;h=b1f5c918fa68dd9d1d29e09a710c60d73b3bd51e;hb=230b5907e242aa48bb8c8d09450fbd3767e9c24a;hp=302624fc5d0944cdd53934bd272a11d942ee8d65;hpb=98d0eb964413f6cc655640f207dde4bf5f1ce89d;p=meshlink diff --git a/src/meshlink.c b/src/meshlink.c index 302624fc..b1f5c918 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -3090,6 +3090,21 @@ end: #endif } +void handle_network_change(meshlink_handle_t *mesh, bool online) { + if(!mesh->connections) { + return; + } + + if(online) { + retry(mesh); + } else { + // We are off-line. Terminate all active connections. + for list_each(connection_t, c, mesh->connections) { + terminate_connection(mesh, c, false); + } + } +} + static void __attribute__((constructor)) meshlink_init(void) { crypto_init(); unsigned int seed;