]> git.meshlink.io Git - meshlink/commitdiff
Set the priv pointer at channel open time in the channels-cornercases test.
authorGuus Sliepen <guus@meshlink.io>
Sun, 13 Oct 2019 19:46:01 +0000 (21:46 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sun, 13 Oct 2019 19:46:01 +0000 (21:46 +0200)
test/channels-cornercases.c

index 3e70686842fae824b5ef503f5a6d16331c8df836..fac9e1fd9543e991f9bc796a55b3b685f1a1e1fb 100644 (file)
@@ -93,10 +93,9 @@ int main() {
 
        struct sync_flag channel_opened = {.flag = false};
 
-       meshlink_channel_t *channel = meshlink_channel_open(a, nb, 7, a_receive_cb, NULL, 0);
+       meshlink_channel_t *channel = meshlink_channel_open(a, nb, 7, a_receive_cb, &channel_opened, 0);
        assert(channel);
 
-       channel->priv = &channel_opened;
        meshlink_set_channel_poll_cb(a, channel, poll_cb);
 
        // Start MeshLink and wait for the channel to become connected.
@@ -121,9 +120,8 @@ int main() {
        nb = meshlink_get_node(a, "b");
        assert(nb);
 
-       channel = meshlink_channel_open(a, nb, 7, a_receive_cb, NULL, 0);
+       channel = meshlink_channel_open(a, nb, 7, a_receive_cb, &channel_opened, 0);
        assert(channel);
-       channel->priv = &channel_opened;
        meshlink_set_channel_poll_cb(a, channel, poll_cb);
 
        assert(wait_sync_flag(&channel_opened, 20));
@@ -146,9 +144,8 @@ int main() {
 
        struct sync_flag channel_polled = {.flag = false};
 
-       meshlink_channel_t *channel2 = meshlink_channel_open(a, nb, 7, a_receive_cb, NULL, 0);
+       meshlink_channel_t *channel2 = meshlink_channel_open(a, nb, 7, a_receive_cb, &channel_polled, 0);
        assert(channel2);
-       channel2->priv = &channel_polled;
        meshlink_set_channel_poll_cb(a, channel2, poll_cb2);
 
        assert(wait_sync_flag(&channel_polled, 20));