diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-28 02:37:14 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2005-08-28 02:37:14 +0000 |
commit | b7b1bb18ec1bfc3bd88ce1c14a1d24876158673f (patch) | |
tree | c64d18f47216bf232c11d1fa52bf7130c009db51 /source/lib/events | |
parent | 265e963ca6f4825fbbfd2fc02a6acbc23a5ead7f (diff) | |
download | samba-b7b1bb18ec1bfc3bd88ce1c14a1d24876158673f.tar.gz samba-b7b1bb18ec1bfc3bd88ce1c14a1d24876158673f.tar.xz samba-b7b1bb18ec1bfc3bd88ce1c14a1d24876158673f.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
Diffstat (limited to 'source/lib/events')
-rw-r--r-- | source/lib/events/events.c | 14 | ||||
-rw-r--r-- | source/lib/events/events.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source/lib/events/events.c b/source/lib/events/events.c index 83b013f3663..b6ba79430c6 100644 --- a/source/lib/events/events.c +++ b/source/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/source/lib/events/events.h b/source/lib/events/events.h index 794407204b1..3570229715e 100644 --- a/source/lib/events/events.h +++ b/source/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 |