mesh: Fix mesh to work with MESH_IO_TYPE_UNIT_TEST
authorInga Stotland <inga.stotland@intel.com>
Wed, 5 Oct 2022 20:43:09 +0000 (13:43 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:55 +0000 (14:55 +0530)
This fixes mesh io flow for MESH_IO_TYPE_UNIT_TEST which
got broken after:
commit 9966cb8b6999a5f54fc13acbd7e1526512a84342
("mesh: Add new kernel MGMT based IO transport")

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
mesh/main.c
mesh/mesh-io.c

index b424bfa..ec2400c 100644 (file)
@@ -140,8 +140,14 @@ static void signal_handler(uint32_t signo, void *user_data)
                return;
 
        l_info("Terminating");
+
        mesh_cleanup(true);
-       l_timeout_create(1, kill_to, NULL, NULL);
+
+       if (io_type != MESH_IO_TYPE_UNIT_TEST)
+               l_timeout_create(1, kill_to, NULL, NULL);
+       else
+               l_main_quit();
+
        terminated = true;
 }
 
index dbeb56a..7fcd7cd 100644 (file)
@@ -150,7 +150,7 @@ struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts,
 
        default_io->api = api;
 
-       if (!api->init(default_io, &default_io->favored_index, user_data))
+       if (!api->init(default_io, opts, user_data))
                goto fail;
 
        return default_io;