maskit commented on a change in pull request #7622:
URL: https://github.com/apache/trafficserver/pull/7622#discussion_r645321364



##########
File path: proxy/http/HttpSM.cc
##########
@@ -1801,19 +1945,51 @@ HttpSM::handle_api_return()
 }
 
 PoolableSession *
-HttpSM::create_server_session(NetVConnection *netvc)
+HttpSM::create_server_session(NetVConnection *netvc, MIOBuffer 
*netvc_read_buffer, IOBufferReader *netvc_reader)
 {
   HttpTransact::State &s  = this->t_state;
-  PoolableSession *retval = httpServerSessionAllocator.alloc();
+  PoolableSession *retval = nullptr;
+
+  // Figure out what protocol was negotiated
+  const unsigned char *proto  = nullptr;
+  unsigned int proto_length   = 0;
+  SSLNetVConnection *sslnetvc = dynamic_cast<SSLNetVConnection *>(netvc);
+  if (sslnetvc) {
+    SSL_get0_alpn_selected(sslnetvc->ssl, &proto, &proto_length);
+  }

Review comment:
       This could be done by ALPNSupport.

##########
File path: proxy/http/HttpSM.cc
##########
@@ -1801,19 +1945,51 @@ HttpSM::handle_api_return()
 }
 
 PoolableSession *
-HttpSM::create_server_session(NetVConnection *netvc)
+HttpSM::create_server_session(NetVConnection *netvc, MIOBuffer 
*netvc_read_buffer, IOBufferReader *netvc_reader)
 {
   HttpTransact::State &s  = this->t_state;
-  PoolableSession *retval = httpServerSessionAllocator.alloc();
+  PoolableSession *retval = nullptr;
+
+  // Figure out what protocol was negotiated
+  const unsigned char *proto  = nullptr;
+  unsigned int proto_length   = 0;
+  SSLNetVConnection *sslnetvc = dynamic_cast<SSLNetVConnection *>(netvc);
+  if (sslnetvc) {
+    SSL_get0_alpn_selected(sslnetvc->ssl, &proto, &proto_length);
+  }
 
-  retval->sharing_pool         = 
static_cast<TSServerSessionSharingPoolType>(s.http_config_param->server_session_sharing_pool);
-  retval->sharing_match        = 
static_cast<TSServerSessionSharingMatchMask>(s.txn_conf->server_session_sharing_match);
-  MIOBuffer *netvc_read_buffer = 
new_MIOBuffer(HTTP_SERVER_RESP_HDR_BUFFER_INDEX);
-  IOBufferReader *netvc_reader = netvc_read_buffer->alloc_reader();
+  bool add_session = false;
+  if (proto_length == 2 && memcmp(proto, "h2", 2) == 0) {
+    Http2ServerSession *session = http2ServerSessionAllocator.alloc();
+    add_session                 = true;
+    retval                      = session;
+  } else {
+    Http1ServerSession *session = httpServerSessionAllocator.alloc();
+    retval                      = session;
+  }

Review comment:
       I understand we need to do this here, but I don't want to have the 
detail here in HttpSM. We should probably have a mechanism like 
`ProtocolProbeSessionAccept`.

##########
File path: proxy/http/HttpSessionManager.cc
##########
@@ -165,9 +165,13 @@ ServerSessionPool::acquireSession(sockaddr const *addr, 
CryptoHash const &hostna
     }
     if (zret == HSM_DONE) {
       to_return = first;
-      this->removeSession(to_return);
-    } else if (first != m_fqdn_pool.end()) {
-      Debug("http_ss", "Failed find entry due to name mismatch %s", 
sm->t_state.current.server->name);
+      if (!to_return->is_multiplexing()) {
+        this->removeSession(to_return);
+      }
+    } else {
+      if (first != m_fqdn_pool.end()) {

Review comment:
       else if

##########
File path: proxy/logging/LogAccess.cc
##########
@@ -1277,7 +1277,7 @@ LogAccess::marshal_client_sni_server_name(char *buf)
   std::string_view server_name = "";
 
   if (m_http_sm) {
-    auto txn = m_http_sm->get_ua_txn();
+    auto txn = m_http_sm->ua_txn;

Review comment:
       Let's use the getter.

##########
File path: proxy/http/HttpSessionManager.cc
##########
@@ -398,7 +404,9 @@ HttpSessionManager::_acquire_session(sockaddr const *ip, 
CryptoHash const &hostn
     // Now check to see if we have a connection in our shared connection pool
     EThread *ethread = this_ethread();
     Ptr<ProxyMutex> pool_mutex =
-      (TS_SERVER_SESSION_SHARING_POOL_THREAD == pool_type) ? 
ethread->server_session_pool->mutex : m_g_pool->mutex;
+      (TS_SERVER_SESSION_SHARING_POOL_THREAD == 
sm->t_state.http_config_param->server_session_sharing_pool) ?

Review comment:
       `pool_type` that is passed by the caller is used after acquiring the 
lock. Doesn't it cause mismatch?




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