traeak commented on code in PR #10117:
URL: https://github.com/apache/trafficserver/pull/10117#discussion_r1309019881


##########
proxy/http/HttpSessionManager.cc:
##########
@@ -146,52 +146,75 @@ ServerSessionPool::acquireSession(sockaddr const *addr, 
CryptoHash const &hostna
   HSMresult_t zret = HSM_NOT_FOUND;
   to_return        = nullptr;
 
+  // use the nethandler for same thread check
+  EThread *ethread            = this_ethread();
+  NetHandler const *const tnh = get_NetHandler(ethread);
+
   if ((TS_SERVER_SESSION_SHARING_MATCH_MASK_HOSTONLY & match_style) && 
!(TS_SERVER_SESSION_SHARING_MATCH_MASK_IP & match_style)) {
     Debug("http_ss", "Search for host name only not IP.  Pool size %zu", 
m_fqdn_pool.count());
-    // This is broken out because only in this case do we check the host hash 
first. The range must be checked
-    // to verify an upstream that matches port and SNI name is selected. Walk 
backwards to select oldest.
-    in_port_t port = ats_ip_port_cast(addr);
-    auto first     = m_fqdn_pool.find(hostname_hash);
-    while (first != m_fqdn_pool.end() && first->hostname_hash == 
hostname_hash) {
-      Debug("http_ss", "Compare port 0x%x against 0x%x", port, 
ats_ip_port_cast(first->get_remote_addr()));
-      if (port == ats_ip_port_cast(first->get_remote_addr()) &&
-          (!(match_style & TS_SERVER_SESSION_SHARING_MATCH_MASK_SNI) || 
validate_sni(sm, first->get_netvc())) &&
-          (!(match_style & TS_SERVER_SESSION_SHARING_MATCH_MASK_HOSTSNISYNC) 
|| validate_host_sni(sm, first->get_netvc())) &&
-          (!(match_style & TS_SERVER_SESSION_SHARING_MATCH_MASK_CERT) || 
validate_cert(sm, first->get_netvc()))) {
-        zret = HSM_DONE;
-        break;
+    // This is broken out because only in this case do we check
+    // the host hash first. The range must be checked to verify
+    // an upstream that matches port and SNI name is selected.
+    // Walk backwards to select oldest.
+    // Prefer a session that's already on this thread.
+    in_port_t const port = ats_ip_port_cast(addr);
+    auto iter            = m_fqdn_pool.find(hostname_hash);
+    while (iter != m_fqdn_pool.end() && iter->hostname_hash == hostname_hash) {
+      Debug("http_ss", "Compare port 0x%x against 0x%x", port, 
ats_ip_port_cast(iter->get_remote_addr()));
+      auto *const netvc = dynamic_cast<UnixNetVConnection 
*>(iter->get_netvc());

Review Comment:
   got it thanks.



-- 
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: [email protected]

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

Reply via email to