Add tevent_req_notify_callback
authorVolker Lendecke <vl@samba.org>
Thu, 4 Jun 2009 15:26:23 +0000 (17:26 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 9 Sep 2009 10:45:02 +0000 (12:45 +0200)
This is necessary for requests that have multiple results. Examples would be
SMBEcho and ldap_search.
(cherry picked from commit c6f39b46a7b0505331612a1bee15a82f97009f0d)
(cherry picked from commit 8d988b165d373d074b8be321bcc9c20a8e85a6fc)

lib/tevent/tevent.h
lib/tevent/tevent_req.c

index 6c5df6321a5be6d972bc7588ed33f639773401ef..2cbd175e73f5add07af71dc6ba13466864d7fd19 100644 (file)
@@ -252,6 +252,10 @@ bool tevent_req_set_endtime(struct tevent_req *req,
                            struct tevent_context *ev,
                            struct timeval endtime);
 
+void _tevent_req_notify_callback(struct tevent_req *req, const char *location);
+#define tevent_req_notify_callback(req)                \
+       _tevent_req_notify_callback(req, __location__)
+
 void _tevent_req_done(struct tevent_req *req,
                      const char *location);
 #define tevent_req_done(req) \
index 01700006eb9eca777de7d2fa35b485fd8b8100c7..541f93f99c3e36fe77d4f18823484edfc503656b 100644 (file)
@@ -117,17 +117,22 @@ struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx,
        return req;
 }
 
-static void tevent_req_finish(struct tevent_req *req,
-                             enum tevent_req_state state,
-                             const char *location)
+void _tevent_req_notify_callback(struct tevent_req *req, const char *location)
 {
-       req->internal.state = state;
        req->internal.finish_location = location;
        if (req->async.fn != NULL) {
                req->async.fn(req);
        }
 }
 
+static void tevent_req_finish(struct tevent_req *req,
+                             enum tevent_req_state state,
+                             const char *location)
+{
+       req->internal.state = state;
+       _tevent_req_notify_callback(req, location);
+}
+
 /**
  * @brief An async request has successfully finished
  * @param[in] req      The finished request