You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "zwoop (via GitHub)" <gi...@apache.org> on 2023/03/06 18:48:52 UTC

[GitHub] [trafficserver] zwoop commented on a diff in pull request #9499: libswoc: Replace IpMap in ControlMatcher.

zwoop commented on code in PR #9499:
URL: https://github.com/apache/trafficserver/pull/9499#discussion_r1126882121


##########
proxy/ControlMatcher.cc:
##########
@@ -651,23 +651,21 @@ template <class Data, class MatchResult>
 void
 IpMatcher<Data, MatchResult>::Match(sockaddr const *addr, RequestData *rdata, MatchResult *result) const
 {
-  void *raw;
-  if (ip_map.contains(addr, &raw)) {
-    Data *cur = static_cast<Data *>(raw);
-    ink_assert(cur != nullptr);
-    cur->UpdateMatch(result, rdata);
+  if (auto &&[range, data]{*ip_addrs.find(swoc::IPAddr(addr))}; !range.empty()) {
+    ink_assert(data != nullptr);
+    data->UpdateMatch(result, rdata);
   }
 }
 
 template <class Data, class MatchResult>
 void
 IpMatcher<Data, MatchResult>::Print() const
 {
-  printf("\tIp Matcher with %d elements, %zu ranges.\n", num_el, ip_map.count());
-  for (auto &spot : ip_map) {
-    char b1[INET6_ADDRSTRLEN], b2[INET6_ADDRSTRLEN];
-    printf("\tRange %s - %s ", ats_ip_ntop(spot.min(), b1, sizeof b1), ats_ip_ntop(spot.max(), b2, sizeof b2));
-    static_cast<Data *>(spot.data())->Print();
+  std::string tmp;
+  printf("\tIp Matcher with %d elements, %zu ranges.\n", num_el, ip_addrs.count());

Review Comment:
   This looks like debugging remnant?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org