X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink.c;h=460256551ee7198ff2e83fc4fb9db7507d4e7d74;hb=93f89bcae11e8d250831896bc5694ee8bd2ad22b;hp=4abacb1433afd18b35c2027d7aef64af1ad932a6;hpb=d69b90d2e3f9359261c96da8b4449c1d19d47835;p=meshlink diff --git a/src/meshlink.c b/src/meshlink.c index 4abacb14..46025655 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -43,6 +43,7 @@ const char *meshlink_strerror(meshlink_errno_t errno) { // TODO: hack, remove once all global variables are gone. static void set_mesh(meshlink_handle_t *localmesh) { mesh = localmesh; + loop = &mesh->loop; } static bool ecdsa_keygen(meshlink_handle_t *mesh) { @@ -212,6 +213,7 @@ meshlink_handle_t *meshlink_open(const char *confbase, const char *name) { meshlink_handle_t *mesh = xzalloc(sizeof *mesh); mesh->confbase = xstrdup(confbase); mesh->name = xstrdup(name); + event_loop_init(&mesh->loop); set_mesh(mesh); // TODO: should be set by a function. @@ -288,7 +290,7 @@ void meshlink_close(meshlink_handle_t *mesh) { logger(DEBUG_ALWAYS, LOG_NOTICE, "Terminating"); exit_configuration(&mesh->config); - + event_loop_exit(&mesh->loop); } void meshlink_set_receive_cb(meshlink_handle_t *mesh, meshlink_receive_cb_t cb) {