jpeach commented on code in PR #9482:
URL: https://github.com/apache/trafficserver/pull/9482#discussion_r1257393172


##########
iocore/net/I_NetVConnection.h:
##########
@@ -540,3 +562,71 @@ NetVConnection::trapWriteBufferEmpty(int event)
 {
   write_buffer_empty_event = event;
 }
+
+inline void *
+NetVConnection::_get_service(enum NetVConnection::Service service) const
+{
+  return _services[static_cast<unsigned int>(service)];
+}
+
+inline void
+NetVConnection::_set_service(enum NetVConnection::Service service, void 
*instance)

Review Comment:
   Note that this isn't type-safe. I expect it would be possible to make it 
typesafe if you had a template that mapped the enum to the type directly.



##########
proxy/http/Http1ClientSession.cc:
##########
@@ -141,7 +141,7 @@ Http1ClientSession::new_connection(NetVConnection *new_vc, 
MIOBuffer *iobuf, IOB
   trans.mutex = mutex; // Share this mutex with the transaction
   in_destroy  = false;
 
-  TLSEarlyDataSupport *eds = dynamic_cast<TLSEarlyDataSupport *>(new_vc);
+  TLSEarlyDataSupport *eds = new_vc->get_service<TLSEarlyDataSupport>();
   if (eds != nullptr) {

Review Comment:
   ```suggestion
     if (TLSEarlyDataSupport *eds = new_vc->get_service<TLSEarlyDataSupport>()) 
{
   ```
   
   We should be consistent about how we call `get_service`.



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