Index: /branches/rel_apv_10_7/usr/click/lib/libdns_agent/dns_daemon.c
===================================================================
--- /branches/rel_apv_10_7/usr/click/lib/libdns_agent/dns_daemon.c	(revision 38945)
+++ /branches/rel_apv_10_7/usr/click/lib/libdns_agent/dns_daemon.c	(working copy)
@@ -417,11 +417,11 @@
 }
 
 /* c-ares ares_getaddrinfo() callback function */
-static void 
+static void
 addrinfo_cb(void *arg, int status, int timeouts, struct ares_addrinfo *result)
 {
 	uint32_t *ttl = (uint32_t *)arg;
-	
+
 	// fastlog_syslog(LOG_DEBUG,"%s: Result: %s, timeouts: %d", __FUNCTION__ ares_strerror(status), timeouts);
 	if (result) {
 		struct ares_addrinfo_node *node = result->nodes;
@@ -478,24 +478,25 @@
 	ares_library_init(ARES_LIB_INIT_ALL);
 
 	memset(&options, 0, sizeof(options));
-  	optmask      |= ARES_OPT_EVENT_THREAD;
+	optmask      |= ARES_OPT_EVENT_THREAD;
 	options.evsys = ARES_EVSYS_DEFAULT;
 
 	if (ares_init_options(&channel, &options, optmask) != ARES_SUCCESS) {
 		fastlog_syslog(LOG_DEBUG, "c-ares initialization issue");
-		return -3;
+		dns_req_wait_list[free_idx].ttl = 0; /* will assign DEFAULT_WEBAGENT_DNS_TTL in domain_resolve_poll() */
 	}
-		
-	memset(&hints, 0, sizeof(hints));
-	hints.ai_family = AF_UNSPEC;
-	hints.ai_flags  = ARES_AI_CANONNAME;
-	ares_getaddrinfo(channel, host, NULL, &hints, addrinfo_cb, &ttl);
+	else {
+		memset(&hints, 0, sizeof(hints));
+		hints.ai_family = AF_UNSPEC;
+		hints.ai_flags  = ARES_AI_CANONNAME;
+		ares_getaddrinfo(channel, host, NULL, &hints, addrinfo_cb, &ttl);
+		dns_req_wait_list[free_idx].ttl = ttl;
 
-	ares_queue_wait_empty(channel, timeout_ms);	/* if empty or timeout in timeout_ms millisecond */
-	ares_destroy(channel);
+		ares_queue_wait_empty(channel, timeout_ms);	/* if empty or timeout in timeout_ms millisecond */
+		ares_destroy(channel);
+	}
 	ares_library_cleanup();
 
-	dns_req_wait_list[free_idx].ttl = ttl;
 
 	outstanding_dns_req_cnt++;
 	//fastlog_syslog(LOG_DEBUG, "%s: sent req for %s(idx %d), out reqs %d",
@@ -538,10 +539,9 @@
 			if (res->ai_addr->sa_family == AF_INET) {
 				struct sockaddr_in *my_addr = (struct sockaddr_in *)res->ai_addr;
 				fastlog_syslog(LOG_DEBUG, "%s: [%d], outstanding req %d, thread id %d: host %s -> ip %s",
-					       __FUNCTION__, i, outstanding_dns_req_cnt, webagent_ctx->thread_id,
-					       webagent_ctx->host, inet_ntoa(my_addr->sin_addr));
-				
-                                webagent_ctx->iptable.ip4_dns_record_table[0].ip = my_addr->sin_addr.s_addr;
+							__FUNCTION__, i, outstanding_dns_req_cnt, webagent_ctx->thread_id,
+							webagent_ctx->host, inet_ntoa(my_addr->sin_addr));
+				webagent_ctx->iptable.ip4_dns_record_table[0].ip = my_addr->sin_addr.s_addr;
 				if (dns_req_wait_list[i].ttl){		/* check if ttl is valid */
 					webagent_ctx->iptable.ip4_dns_record_table[0].ttl = dns_req_wait_list[i].ttl;
 				}else{
