summaryrefslogtreecommitdiff
path: root/source4/lib/events
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-28 02:37:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:51 -0500
commitc98c6aa5611f26ab591c50fcded1fc55e81a0d07 (patch)
tree599e3e9efc13a33535b50d40d9035c57a853dc19 /source4/lib/events
parente669d0c53d843e664fc5b3d8f3ebcb170ceb8f37 (diff)
downloadsamba-c98c6aa5611f26ab591c50fcded1fc55e81a0d07.tar.gz
samba-c98c6aa5611f26ab591c50fcded1fc55e81a0d07.tar.bz2
samba-c98c6aa5611f26ab591c50fcded1fc55e81a0d07.zip
r9702: r9680@blu: tridge | 2005-08-27 18:45:08 +1000
- fixed ncacn_ip_tcp to use the generic async name resolution methods, so NBT names now work (as requested several times by abartlet!) - changed resolve_name() to take an event_context, so it doesn't cause the whole process to block - cleaned up the talloc_find_parent_bytype() calls to go via a cleaner event_context_find() call (This used to be commit b3d491b210a8b889a25efcb273e70fefbd01b7f7)
Diffstat (limited to 'source4/lib/events')
-rw-r--r--source4/lib/events/events.c14
-rw-r--r--source4/lib/events/events.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c
index 83b013f366..b6ba79430c 100644
--- a/source4/lib/events/events.c
+++ b/source4/lib/events/events.c
@@ -153,3 +153,17 @@ int event_loop_wait(struct event_context *ev)
{
return ev->ops->loop_wait(ev);
}
+
+/*
+ find an event context that is a parent of the given memory context,
+ or create a new event context as a child of the given context if
+ none is found
+*/
+struct event_context *event_context_find(TALLOC_CTX *mem_ctx)
+{
+ struct event_context *ev = talloc_find_parent_bytype(mem_ctx, struct event_context);
+ if (ev == NULL) {
+ ev = event_context_init(mem_ctx);
+ }
+ return ev;
+}
diff --git a/source4/lib/events/events.h b/source4/lib/events/events.h
index 794407204b..3570229715 100644
--- a/source4/lib/events/events.h
+++ b/source4/lib/events/events.h
@@ -49,6 +49,8 @@ int event_loop_wait(struct event_context *ev);
uint16_t event_get_fd_flags(struct fd_event *fde);
void event_set_fd_flags(struct fd_event *fde, uint16_t flags);
+struct event_context *event_context_find(TALLOC_CTX *mem_ctx);
+
/* bits for file descriptor event flags */
#define EVENT_FD_READ 1
#define EVENT_FD_WRITE 2