]> git.meshlink.io Git - meshlink/commitdiff
Inform UTCP when a node is offline, so it will start connection timeouts.
authorGuus Sliepen <guus@meshlink.io>
Sun, 7 Jul 2019 16:12:18 +0000 (18:12 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sun, 7 Jul 2019 16:12:18 +0000 (18:12 +0200)
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.

src/graph.c
src/utcp
test/channels-failure.c

index 19a33e2e9de1485cd1d7a462168ff288bbf2e49b..8e39b98d62f7e0c0167ad36b4fa697c2e7864cd2 100644 (file)
@@ -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);
                        }
                }
        }
index 6ef1b39de8c0b0537da02b212acaba3242afe142..fa93ca75a603758e00781f2e9acb52bdbe6695b7 160000 (submodule)
--- a/src/utcp
+++ b/src/utcp
@@ -1 +1 @@
-Subproject commit 6ef1b39de8c0b0537da02b212acaba3242afe142
+Subproject commit fa93ca75a603758e00781f2e9acb52bdbe6695b7
index db8889615aa3eab91fb7a7f892d48b228da51754..9829b4501fb4596b0b5022dcdb292e2799b171c4 100644 (file)
@@ -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);