Github user SolidWallOfCode commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/1594#discussion_r107026702
  
    --- Diff: proxy/InkAPI.cc ---
    @@ -9112,6 +9113,65 @@ TSSslContextDestroy(TSSslContext ctx)
       SSLReleaseContext(reinterpret_cast<SSL_CTX *>(ctx));
     }
     
    +void
    +TSRegisterProtocolSet(TSVConn sslp, TSNextProtocolSet ps)
    +{
    +  NetVConnection *vc        = reinterpret_cast<NetVConnection *>(sslp);
    +  SSLNetVConnection *ssl_vc = dynamic_cast<SSLNetVConnection *>(vc);
    +  if (ssl_vc) {
    +    ssl_vc->registerNextProtocolSet(reinterpret_cast<SSLNextProtocolSet 
*>(ps));
    +  }
    +}
    +
    +TSNextProtocolSet
    +TSUnregisterProtocol(TSNextProtocolSet protoset, const char *protocol)
    +{
    +  SSLNextProtocolSet *snps = reinterpret_cast<SSLNextProtocolSet 
*>(protoset);
    +  if (snps) {
    +    snps->unregisterEndpoint(protocol, nullptr);
    +    return reinterpret_cast<TSNextProtocolSet>(snps);
    +  }
    +  return nullptr;
    +}
    +
    +TSAcceptor
    +TSAcceptorGet(TSVConn sslp)
    +{
    +  NetVConnection *vc        = reinterpret_cast<NetVConnection *>(sslp);
    +  SSLNetVConnection *ssl_vc = dynamic_cast<SSLNetVConnection *>(vc);
    +  return ssl_vc ? reinterpret_cast<TSAcceptor>(ssl_vc->accept_object) : 
nullptr;
    +}
    +
    +extern std::vector<NetAccept *> naVec;
    +TSAcceptor
    +TSAcceptorGetbyID(int ID)
    +{
    +  Debug("ssl", "getNetAccept in INK API.cc %p", naVec.at(ID));
    +  return reinterpret_cast<TSAcceptor>(naVec.at(ID));
    +}
    +
    +int
    +TSAcceptorIDGet(TSAcceptor acceptor)
    +{
    +  NetAccept *na = reinterpret_cast<NetAccept *>(acceptor);
    +  return na ? na->id : -1;
    +}
    +
    +int
    +TSAcceptorCount()
    +{
    +  return naVec.size();
    +}
    +
    +// clones the protoset associated with netAccept
    +TSNextProtocolSet
    +TSGetcloneProtoSet(TSAcceptor tna)
    +{
    +  NetAccept *na = reinterpret_cast<NetAccept *>(tna);
    +  // clone protoset
    +  return (na && na->snpa) ? 
reinterpret_cast<TSNextProtocolSet>(na->snpa->cloneProtoSet()) : nullptr;
    --- End diff --
    
    Style: maybe
    ```
    return reinterpret_cast<TSNextProtocolSet>(na && na->snpa ? 
na->snpa->cloneProtoSet() : nullptr);
    ```
    The key point being the type of the ternary operator is not mixed and 
exposed to the `return` statement. Not sure that's worth it but sometimes it 
can be a compilation issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to