summaryrefslogtreecommitdiff
path: root/ares_init.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_init.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_init.c')
-rw-r--r--ares_init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ares_init.c b/ares_init.c
index add3ffe..298dd7b 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -136,6 +136,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
channel->nservers = -1;
channel->ndomains = -1;
channel->nsort = -1;
+ channel->tcp_connection_generation = 0;
channel->lookups = NULL;
channel->queries = NULL;
channel->domains = NULL;
@@ -201,10 +202,12 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
server = &channel->servers[i];
server->udp_socket = ARES_SOCKET_BAD;
server->tcp_socket = ARES_SOCKET_BAD;
+ server->tcp_connection_generation = ++channel->tcp_connection_generation;
server->tcp_lenbuf_pos = 0;
server->tcp_buffer = NULL;
server->qhead = NULL;
server->qtail = NULL;
+ server->is_broken = 0;
}
init_id_key(&channel->id_key, ARES_ID_KEY_LEN);