add request cancelled flag
This commit is contained in:
parent
527d252333
commit
749aaf3b6d
2 changed files with 8 additions and 1 deletions
|
@ -178,7 +178,8 @@ static void ubus_process_req_data(struct ubus_request *req)
|
|||
data = list_first_entry(&req->pending,
|
||||
struct ubus_pending_data, list);
|
||||
list_del(&data->list);
|
||||
req->data_cb(req, data->type, data->data);
|
||||
if (!req->cancelled)
|
||||
req->data_cb(req, data->type, data->data);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
@ -300,6 +301,8 @@ void ubus_abort_request(struct ubus_context *ctx, struct ubus_request *req)
|
|||
if (!list_empty(&req->list))
|
||||
return;
|
||||
|
||||
req->cancelled = true;
|
||||
ubus_process_req_data(req);
|
||||
list_del(&req->list);
|
||||
}
|
||||
|
||||
|
@ -331,6 +334,9 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req)
|
|||
if (req->status_msg)
|
||||
return req->status_code;
|
||||
|
||||
if (req->cancelled)
|
||||
return UBUS_STATUS_NO_DATA;
|
||||
|
||||
if (!get_next_msg(ctx, true))
|
||||
return UBUS_STATUS_NO_DATA;
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ struct ubus_request {
|
|||
bool status_msg;
|
||||
int status_code;
|
||||
bool blocked;
|
||||
bool cancelled;
|
||||
|
||||
uint32_t peer;
|
||||
uint32_t seq;
|
||||
|
|
Loading…
Add table
Reference in a new issue