summaryrefslogtreecommitdiff
path: root/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
commitb669e17544c0ff64d120b8a0df2677c59ccea8fd (patch)
tree7c2fb632dc14992a0528fd0649104acd9d2ddeed /ares_send.c
parenta6a159dcad51c729e7601eee75c82ffc7045e4bb (diff)
downloadc-ares-b669e17544c0ff64d120b8a0df2677c59ccea8fd.tar.gz
c-ares-b669e17544c0ff64d120b8a0df2677c59ccea8fd.tar.bz2
c-ares-b669e17544c0ff64d120b8a0df2677c59ccea8fd.zip
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_send.c')
-rw-r--r--ares_send.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ares_send.c b/ares_send.c
index 7f4362c..fd1450b 100644
--- a/ares_send.c
+++ b/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;