support passing args to request handle for elimination of global var

This commit is contained in:
Rongsong Shen 2025-12-11 17:07:51 +08:00
parent 79124c6e5c
commit 486b38d679
8 changed files with 120 additions and 19 deletions

View file

@ -29,7 +29,7 @@ xcecli_ctx_t xcecli_ctx = { 0 };
xce_client_config_t xce_client_cfg = { 0 };
controller_connector_ctx_t* cc_ctx = NULL;
static int myreq_handler(xce_request_t*);
static int myreq_handler(xce_request_t*, void*);
/* make compiler happy */
typedef struct {
@ -240,7 +240,7 @@ int xcecd_join_cluster(hostattrs_t* attrs)
int role = HostRole_worker;
xcecli_ctx_init(&xcecli_ctx, &xce_client_cfg);
xcecli_set_handler(xcecli_ctx, &myreq_handler);
xcecli_set_handler(xcecli_ctx, &myreq_handler, NULL);
xcecli_start(xcecli_ctx);
rc = xcecli_join(xcecli_ctx, role, attrs);
@ -1218,7 +1218,7 @@ static int handle_jobcontrol(xce_request_t* request)
* @param ctx Pointer to the I/O context structure.
* @return int 0 on success, -1 on failure.
*/
static int myreq_handler(xce_request_t* request)
static int myreq_handler(xce_request_t* request, void* args)
{
int ret = 0;
@ -1513,4 +1513,4 @@ int xcecd_jobpost_done(uint64_t jobid)
XCECD_LOG(XCE_LOG_DEBUG,
"Job post done and calling xcecli_notify_jobpostdone...");
return xcecli_notify_jobpostdone(xcecli_ctx, jobid);
}
}