bryancall commented on a change in pull request #6791:
URL: https://github.com/apache/trafficserver/pull/6791#discussion_r425895998



##########
File path: iocore/net/P_NetVConnection.h
##########
@@ -89,18 +89,12 @@ NetVConnection::get_local_port()
 inline sockaddr const *
 NetVConnection::get_proxy_protocol_addr(const ProxyProtocolData src_or_dst)
 {
-  if (src_or_dst == ProxyProtocolData::SRC) {
-    if ((pp_info.src_addr.isValid() && pp_info.src_addr.port() != 0) ||
-        (ats_is_ip4(&pp_info.src_addr) && INADDR_ANY != 
ats_ip4_addr_cast(&pp_info.src_addr)) // IPv4
-        || (ats_is_ip6(&pp_info.src_addr) && 
!IN6_IS_ADDR_UNSPECIFIED(&pp_info.src_addr.sin6.sin6_addr))) {
-      return &pp_info.src_addr.sa;
-    }
-  } else {
-    if ((pp_info.dst_addr.isValid() && pp_info.dst_addr.port() != 0) ||
-        (ats_is_ip4(&pp_info.dst_addr) && INADDR_ANY != 
ats_ip4_addr_cast(&pp_info.dst_addr)) // IPv4
-        || (ats_is_ip6(&pp_info.dst_addr) && 
!IN6_IS_ADDR_UNSPECIFIED(&pp_info.dst_addr.sin6.sin6_addr))) {
-      return &pp_info.dst_addr.sa;
-    }
+  IpEndpoint &addr = (src_or_dst == ProxyProtocolData::SRC ? pp_info.src_addr 
: pp_info.dst_addr);

Review comment:
       Can addr be const too?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to