summaryrefslogtreecommitdiff
path: root/ares_private.h
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_private.h
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_private.h')
-rw-r--r--ares_private.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/ares_private.h b/ares_private.h
index f031451..dd9070a 100644
--- a/ares_private.h
+++ b/ares_private.h
@@ -89,6 +89,11 @@ struct send_request {
const unsigned char *data;
size_t len;
+ /* The query for which we're sending this data */
+ struct query* owner_query;
+ /* The buffer we're using, if we have our own copy of the packet */
+ unsigned char *data_storage;
+
/* Next request in queue */
struct send_request *next;
};
@@ -110,6 +115,17 @@ struct server_state {
/* TCP output queue */
struct send_request *qhead;
struct send_request *qtail;
+
+ /* Which incarnation of this connection is this? We don't want to
+ * retransmit requests into the very same socket, but if the server
+ * closes on us and we re-open the connection, then we do want to
+ * re-send. */
+ int tcp_connection_generation;
+
+ /* Is this server broken? We mark connections as broken when a
+ * request that is queued for sending times out.
+ */
+ int is_broken;
};
struct query {
@@ -130,7 +146,7 @@ struct query {
/* Query status */
int try;
int server;
- int *skip_server;
+ struct query_server_info *server_info; /* per-server state */
int using_tcp;
int error_status;
@@ -138,6 +154,12 @@ struct query {
struct query *next;
};
+/* Per-server state for a query */
+struct query_server_info {
+ int skip_server; /* should we skip server, due to errors, etc? */
+ int tcp_connection_generation; /* into which TCP connection did we send? */
+};
+
/* An IP address pattern; matches an IP address X if X & mask == addr */
#define PATTERN_MASK 0x1
#define PATTERN_CIDR 0x2
@@ -188,6 +210,9 @@ struct ares_channeldata {
/* key to use when generating new ids */
rc4_key id_key;
+ /* Generation number to use for the next TCP socket open/close */
+ int tcp_connection_generation;
+
/* Active queries */
struct query *queries;
@@ -220,4 +245,3 @@ short ares__generate_new_id(rc4_key* key);
#endif
#endif /* __ARES_PRIVATE_H */
-