From 995d26977acbb705e17ff9c01558d9d64208058d Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Wed, 13 Jan 2010 17:03:53 +0100 Subject: Don't recursively call ares_process_fd() from fd_event() Since ares_process_fd() might also cause fd_event() to be called again, calling ares_process_fd() is unwise. The bug will cause a crash if c-ares is using tcp connections. Fixes: #384 --- server/resolv/async_resolv.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/server/resolv/async_resolv.c b/server/resolv/async_resolv.c index 5fd4084b0..ff84b386d 100644 --- a/server/resolv/async_resolv.c +++ b/server/resolv/async_resolv.c @@ -195,7 +195,6 @@ unschedule_timeout_watcher(struct resolv_ctx *ctx) } static void fd_event_add(struct resolv_ctx *ctx, int s); -static void fd_event_write(struct resolv_ctx *ctx, int s); static void fd_event_close(struct resolv_ctx *ctx, int s); /* @@ -216,11 +215,6 @@ fd_event(void *data, int s, int fd_read, int fd_write) return; } - /* If ares needs to write to a descriptor */ - if (fd_write == 1) { - fd_event_write(ctx, s); - } - /* Are we already watching this file descriptor? */ watch = ctx->fds; while (watch) { @@ -259,17 +253,6 @@ fd_event_add(struct resolv_ctx *ctx, int s) DLIST_ADD(ctx->fds, watch); } -static void -fd_event_write(struct resolv_ctx *ctx, int s) -{ - if (ctx->channel == NULL) { - DEBUG(1, ("Invalid ares channel - this is likely a bug\n")); - return; - } - /* do not allow any read. */ - ares_process_fd(ctx->channel, ARES_SOCKET_BAD, s); -} - static void fd_event_close(struct resolv_ctx *ctx, int s) { -- cgit