From d1023a49bbb21d4b0a652238404e9baae562a42b Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 14 Mar 2024 08:35:34 -0700 Subject: [PATCH] resource: call status disconnect handler Problem: when a client disconnects with a resource.status RPC pending, the RPC is not aborted. Change the resource module disconnect handler to allow non-owners to send the message (and verify that the acquire handler is using proper authentication). Then call status_disconnect() from the handler. --- src/modules/resource/resource.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/resource/resource.c b/src/modules/resource/resource.c index a4e8e4917c3e..2899655a118c 100644 --- a/src/modules/resource/resource.c +++ b/src/modules/resource/resource.c @@ -172,7 +172,6 @@ static void config_reload_cb (flux_t *h, } /* Handle client disconnect. - * Abort a streaming resource.acquire RPC, if it matches. */ static void disconnect_cb (flux_t *h, flux_msg_handler_t *mh, @@ -183,6 +182,8 @@ static void disconnect_cb (flux_t *h, if (ctx->acquire) acquire_disconnect (ctx->acquire, msg); + if (ctx->status) + status_disconnect (ctx->status, msg); } flux_t *resource_parent_handle_open (struct resource_ctx *ctx) @@ -247,7 +248,7 @@ static const struct flux_msg_handler_spec htab[] = { .typemask = FLUX_MSGTYPE_REQUEST, .topic_glob = "resource.disconnect", .cb = disconnect_cb, - .rolemask = 0 + .rolemask = FLUX_ROLE_USER }, FLUX_MSGHANDLER_TABLE_END, };