From: Guus Sliepen Date: Sun, 7 Jul 2019 16:12:18 +0000 (+0200) Subject: Inform UTCP when a node is offline, so it will start connection timeouts. X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=cb8aedb0d1da7fc93299d8fd5005b9631364b7ee Inform UTCP when a node is offline, so it will start connection timeouts. When there are open channels to a node that is offline for longer than the connection timeout, the channels will be marked closed, and callbacks will be fired. --- diff --git a/src/graph.c b/src/graph.c index 19a33e2e..8e39b98d 100644 --- a/src/graph.c +++ b/src/graph.c @@ -237,10 +237,13 @@ static void check_reachability(meshlink_handle_t *mesh) { update_node_udp(mesh, n, NULL); n->status.broadcast = false; n->options = 0; + utcp_offline(n->utcp, true); } else if(n->connection) { if(n->connection->outgoing) { send_req_key(mesh, n); } + + utcp_offline(n->utcp, false); } } } diff --git a/src/utcp b/src/utcp index 6ef1b39d..fa93ca75 160000 --- a/src/utcp +++ b/src/utcp @@ -1 +1 @@ -Subproject commit 6ef1b39de8c0b0537da02b212acaba3242afe142 +Subproject commit fa93ca75a603758e00781f2e9acb52bdbe6695b7 diff --git a/test/channels-failure.c b/test/channels-failure.c index db888961..9829b450 100644 --- a/test/channels-failure.c +++ b/test/channels-failure.c @@ -117,14 +117,10 @@ int main() { sleep(1); - // Stop mesh2, then try to send data to it. We should get a notification that the channel has closed after a while. - - assert(!check_sync_flag(&receive_flag)); + // Stop mesh2. We should get a notification that the channel has closed after a while. meshlink_stop(mesh2); - assert(meshlink_channel_send(mesh1, channel, "hello", 5) == 5); - assert(wait_sync_flag(&receive_flag, 70)); assert(receive_len == 0);