You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/09/27 16:46:24 UTC
[trafficserver] branch master updated: Group HostDBInfo member
variables to improve legibility.
This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 65337c7 Group HostDBInfo member variables to improve legibility.
65337c7 is described below
commit 65337c7a47cde0fba602b13bf55292a2281040da
Author: James Peach <jp...@apache.org>
AuthorDate: Tue Sep 27 09:07:55 2016 -0700
Group HostDBInfo member variables to improve legibility.
---
iocore/hostdb/I_HostDBProcessor.h | 69 +++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 35 deletions(-)
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index a6ce432..8bc3851 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -145,7 +145,6 @@ struct HostDBInfo : public RefCountObj {
This is at least large enough to hold an IPv6 address.
*/
- int iobuffer_index;
static HostDBInfo *
alloc(int size = 0)
{
@@ -195,13 +194,12 @@ struct HostDBInfo : public RefCountObj {
return ip_timestamp + ip_timeout_interval + hostdb_serve_stale_but_revalidate;
}
- uint64_t key;
-
sockaddr *
ip()
{
return &data.ip.sa;
}
+
sockaddr const *
ip() const
{
@@ -211,6 +209,7 @@ struct HostDBInfo : public RefCountObj {
char *hostname() const;
char *perm_hostname() const;
char *srvname(HostDBRoundRobin *rr) const;
+
/// Check if this entry is an element of a round robin entry.
/// If @c true then this entry is part of and was obtained from a round robin root. This is useful if the
/// address doesn't work - a retry can probably get a new address by doing another lookup and resolving to
@@ -220,15 +219,8 @@ struct HostDBInfo : public RefCountObj {
{
return 0 != round_robin_elt;
}
- HostDBRoundRobin *rr();
- /**
- Application specific data. NOTE: We need an integral number of these
- per block. This structure is 32 bytes. (at 200k hosts = 8 Meg). Which
- gives us 7 bytes of application information.
-
- */
- HostDBApplicationInfo app;
+ HostDBRoundRobin *rr();
unsigned int
ip_interval() const
@@ -270,8 +262,9 @@ struct HostDBInfo : public RefCountObj {
serve_stale_but_revalidate() const
{
// the option is disabled
- if (hostdb_serve_stale_but_revalidate <= 0)
+ if (hostdb_serve_stale_but_revalidate <= 0) {
return false;
+ }
// ip_timeout_interval == DNS TTL
// hostdb_serve_stale_but_revalidate == number of seconds
@@ -281,33 +274,11 @@ struct HostDBInfo : public RefCountObj {
hostdb_serve_stale_but_revalidate, ip_interval());
return true;
}
+
// otherwise, the entry is too old
return false;
}
- //
- // Private
- //
-
- union {
- IpEndpoint ip; ///< IP address / port data.
- unsigned int hostname_offset; ///< Some hostname thing.
- SRVInfo srv;
- } data;
-
- unsigned int hostname_offset; // always maintain a permanent copy of the hostname for non-rev dns records.
-
- unsigned int ip_timestamp;
- // limited to HOST_DB_MAX_TTL (0x1FFFFF, 24 days)
- // if this is 0 then no timeout.
- unsigned int ip_timeout_interval;
-
- unsigned int is_srv : 1;
- unsigned int reverse_dns : 1;
-
- unsigned int round_robin : 1; // This is the root of a round robin block
- unsigned int round_robin_elt : 1; // This is an address in a round robin block
-
/*
* Given the current time `now` and the fail_window, determine if this real is alive
*/
@@ -348,6 +319,34 @@ struct HostDBInfo : public RefCountObj {
else
ats_ip_invalidate(ip());
}
+
+ int iobuffer_index;
+
+ uint64_t key;
+
+ // Application specific data. NOTE: We need an integral number of
+ // these per block. This structure is 32 bytes. (at 200k hosts =
+ // 8 Meg). Which gives us 7 bytes of application information.
+ HostDBApplicationInfo app;
+
+ union {
+ IpEndpoint ip; ///< IP address / port data.
+ unsigned int hostname_offset; ///< Some hostname thing.
+ SRVInfo srv;
+ } data;
+
+ unsigned int hostname_offset; // always maintain a permanent copy of the hostname for non-rev dns records.
+
+ unsigned int ip_timestamp;
+ // limited to HOST_DB_MAX_TTL (0x1FFFFF, 24 days)
+ // if this is 0 then no timeout.
+ unsigned int ip_timeout_interval;
+
+ unsigned int is_srv : 1;
+ unsigned int reverse_dns : 1;
+
+ unsigned int round_robin : 1; // This is the root of a round robin block
+ unsigned int round_robin_elt : 1; // This is an address in a round robin block
};
struct HostDBRoundRobin {
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].