From c99507d8c6e02e53e3a6f91d02657d79a2d2ef7b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 20 Sep 2012 16:25:58 +0200 Subject: s3:smb2_notify: make use of tevent_req_defer_callback() instead of custom tevent_immediate metze (cherry picked from commit 882cee0acb9c1e2105a005f0ea90691197a696c7) Signed-off-by: Stefan Metzmacher --- source3/smbd/smb2_notify.c | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index 0980c51ac4e..2c598e8d668 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -28,7 +28,6 @@ struct smbd_smb2_notify_state { struct smbd_smb2_request *smb2req; struct smb_request *smbreq; - struct tevent_immediate *im; NTSTATUS status; DATA_BLOB out_output_buffer; }; @@ -177,9 +176,6 @@ static void smbd_smb2_request_notify_done(struct tevent_req *subreq) static void smbd_smb2_notify_reply(struct smb_request *smbreq, NTSTATUS error_code, uint8_t *buf, size_t len); -static void smbd_smb2_notify_reply_trigger(struct tevent_context *ctx, - struct tevent_immediate *im, - void *private_data); static bool smbd_smb2_notify_cancel(struct tevent_req *req); static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, @@ -205,7 +201,6 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, state->smb2req = smb2req; state->status = NT_STATUS_INTERNAL_ERROR; state->out_output_buffer = data_blob_null; - state->im = NULL; DEBUG(10,("smbd_smb2_notify_send: %s - %s\n", fsp_str_dbg(fsp), fsp_fnum_dbg(fsp))); @@ -275,11 +270,6 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - state->im = tevent_create_immediate(state); - if (tevent_req_nomem(state->im, req)) { - return tevent_req_post(req, ev); - } - /* * No changes pending, queue the request */ @@ -321,30 +311,7 @@ static void smbd_smb2_notify_reply(struct smb_request *smbreq, } } - if (state->im == NULL) { - smbd_smb2_notify_reply_trigger(NULL, NULL, req); - return; - } - - /* - * if this is called async, we need to go via an immediate event - * because the caller replies on the smb_request (a child of req - * being arround after calling this function - */ - tevent_schedule_immediate(state->im, - state->smb2req->sconn->ev_ctx, - smbd_smb2_notify_reply_trigger, - req); -} - -static void smbd_smb2_notify_reply_trigger(struct tevent_context *ctx, - struct tevent_immediate *im, - void *private_data) -{ - struct tevent_req *req = talloc_get_type_abort(private_data, - struct tevent_req); - struct smbd_smb2_notify_state *state = tevent_req_data(req, - struct smbd_smb2_notify_state); + tevent_req_defer_callback(req, state->smb2req->sconn->ev_ctx); if (!NT_STATUS_IS_OK(state->status)) { tevent_req_nterror(req, state->status); -- cgit v1.2.1