aboutsummaryrefslogtreecommitdiff
path: root/ares/ares_send.c
diff options
context:
space:
mode:
authorSteinar H. Gunderson <sesse@google.com>2007-09-28 14:28:14 +0000
committerSteinar H. Gunderson <sesse@google.com>2007-09-28 14:28:14 +0000
commitd426c20c0a71df7db7a8bae18c91034df502070a (patch)
tree4c0d0bda85996127b88485dda91d9be9b6855565 /ares/ares_send.c
parent54ca7d8cb2ae3c27f958a6c8969ce9edf14a54d1 (diff)
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.
Diffstat (limited to 'ares/ares_send.c')
-rw-r--r--ares/ares_send.c10
1 files changed, 7 insertions, 3 deletions
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;