This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit ed7773870ac9ddece915c512988d83a6fb4e2074
Author: Masaori Koshiba <[email protected]>
AuthorDate: Fri Oct 24 07:42:37 2025 +0900

    Fix setting HostDBRecord::record_type (#12604)
    
    (cherry picked from commit 8dc015d08b6939f60a65c96f58d02b837daa1391)
---
 src/iocore/hostdb/HostDB.cc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/iocore/hostdb/HostDB.cc b/src/iocore/hostdb/HostDB.cc
index b1dfd6eff9..cbf19e24fd 100644
--- a/src/iocore/hostdb/HostDB.cc
+++ b/src/iocore/hostdb/HostDB.cc
@@ -21,6 +21,7 @@
   limitations under the License.
  */
 
+#include "iocore/hostdb/HostDBProcessor.h"
 #include "swoc/swoc_file.h"
 #include "tscore/Regression.h"
 #include "tsutil/ts_bw_format.h"
@@ -829,21 +830,18 @@ HostDBContinuation::lookup_done(TextView query_name, 
ts_seconds answer_ttl, SRVH
   if (query_name.empty()) {
     if (hash.is_byname()) {
       Dbg(dbg_ctl_hostdb, "lookup_done() failed for '%.*s'", 
int(hash.host_name.size()), hash.host_name.data());
+      record->record_type = HostDBType::ADDR;
     } else if (hash.is_srv()) {
       Dbg(dbg_ctl_dns_srv, "SRV failed for '%.*s'", 
int(hash.host_name.size()), hash.host_name.data());
+      record->record_type = HostDBType::SRV;
     } else {
       ip_text_buffer b;
       Dbg(dbg_ctl_hostdb, "failed for %s", hash.ip.toString(b, sizeof b));
+      record->record_type = HostDBType::HOST;
     }
     record->ip_timestamp        = hostdb_current_timestamp;
     record->ip_timeout_interval = 
ts_seconds(std::clamp(hostdb_ip_fail_timeout_interval, 1u, HOST_DB_MAX_TTL));
 
-    if (hash.is_srv()) {
-      record->record_type = HostDBType::SRV;
-    } else if (!hash.is_byname()) {
-      record->record_type = HostDBType::HOST;
-    }
-
     record->set_failed();
 
   } else {
@@ -874,6 +872,7 @@ HostDBContinuation::lookup_done(TextView query_name, 
ts_seconds answer_ttl, SRVH
 
     if (hash.is_byname()) {
       Dbg_bw(dbg_ctl_hostdb, "done {} TTL {}", hash.host_name, answer_ttl);
+      record->record_type = HostDBType::ADDR;
     } else if (hash.is_srv()) {
       ink_assert(srv && srv->hosts.size() && srv->hosts.size() <= 
hostdb_round_robin_max_count);
 

Reply via email to