diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-23 12:17:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:08 -0500 |
commit | 6c14b0133dede38294a812be7f5f5bd5ec3d498b (patch) | |
tree | 6b60ad912d6ff06e1624580ba6e8cbeda3341d1b /source4/lib/messaging | |
parent | fd62df64188c0f992876c72fdda8a6da5dba3090 (diff) | |
download | samba-6c14b0133dede38294a812be7f5f5bd5ec3d498b.tar.gz samba-6c14b0133dede38294a812be7f5f5bd5ec3d498b.tar.bz2 samba-6c14b0133dede38294a812be7f5f5bd5ec3d498b.zip |
r4944: every event_add_*() caller was having to call talloc_steal() to take
control of the event, so instead build that into the function. If you
pass NULL as mem_ctx then it leaves it as a child of the events
structure.
(This used to be commit 7f981b9ed96f39027cbfd500f41e0c2be64cbb50)
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r-- | source4/lib/messaging/messaging.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index beceb342c9..ca7682f5d2 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -220,9 +220,7 @@ static void messaging_listen_handler(struct event_context *ev, struct fd_event * fde2.flags = EVENT_FD_READ; fde2.handler = messaging_recv_handler; - rec->fde = event_add_fd(msg->event.ev, &fde2); - - talloc_steal(rec, rec->fde); + rec->fde = event_add_fd(msg->event.ev, &fde2, rec); } /* @@ -358,8 +356,7 @@ static void messaging_backoff_handler(struct event_context *ev, struct timed_eve fde.flags = EVENT_FD_WRITE; fde.handler = messaging_send_handler; - rec->fde = event_add_fd(msg->event.ev, &fde); - talloc_steal(rec, rec->fde); + rec->fde = event_add_fd(msg->event.ev, &fde, rec); messaging_send_handler(msg->event.ev, rec->fde, timeval_zero(), EVENT_FD_WRITE); } @@ -408,7 +405,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, servid_t server, uint32_t te.next_event = timeval_current_ofs(0, MESSAGING_BACKOFF); te.handler = messaging_backoff_handler; te.private = rec; - event_add_timed(msg->event.ev, &te); + event_add_timed(msg->event.ev, &te, rec); return NT_STATUS_OK; } @@ -422,8 +419,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, servid_t server, uint32_t fde.flags = EVENT_FD_WRITE; fde.handler = messaging_send_handler; - rec->fde = event_add_fd(msg->event.ev, &fde); - talloc_steal(rec, rec->fde); + rec->fde = event_add_fd(msg->event.ev, &fde, rec); messaging_send_handler(msg->event.ev, rec->fde, timeval_zero(), EVENT_FD_WRITE); @@ -501,8 +497,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, servid_t server_id fde.handler = messaging_listen_handler; msg->event.ev = talloc_reference(msg,ev); - msg->event.fde = event_add_fd(ev, &fde); - talloc_steal(msg, msg->event.fde); + msg->event.fde = event_add_fd(ev, &fde, msg); talloc_set_destructor(msg, messaging_destructor); |