From d426c20c0a71df7db7a8bae18c91034df502070a Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 28 Sep 2007 14:28:14 +0000 Subject: Three fixes in one commit (sorry): a) Take care of the tcpbuf if it ends while queued for transmission, note broken servers and close them in the main loop, and store TCP socket generation number in order not to send the same query twice over the same socket. --- ares/ares_send.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ares/ares_send.c') diff --git a/ares/ares_send.c b/ares/ares_send.c index 7f4362c7c..fd1450b4a 100644 --- a/ares/ares_send.c +++ b/ares/ares_send.c @@ -62,8 +62,9 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, callback(arg, ARES_ENOMEM, NULL, 0); return; } - query->skip_server = malloc(channel->nservers * sizeof(int)); - if (!query->skip_server) + query->server_info = malloc(channel->nservers * + sizeof(query->server_info[0])); + if (!query->server_info) { free(query->tcpbuf); free(query); @@ -93,7 +94,10 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, query->try = 0; query->server = 0; for (i = 0; i < channel->nservers; i++) - query->skip_server[i] = 0; + { + query->server_info[i].skip_server = 0; + query->server_info[i].tcp_connection_generation = 0; + } query->using_tcp = (channel->flags & ARES_FLAG_USEVC) || qlen > PACKETSZ; query->error_status = ARES_ECONNREFUSED; -- cgit v1.2.3