bneradt commented on code in PR #12763:
URL: https://github.com/apache/trafficserver/pull/12763#discussion_r2836490512
##########
src/iocore/net/TLSBasicSupport.cc:
##########
@@ -72,6 +72,36 @@ TLSBasicSupport::clear()
{
this->_tls_handshake_begin_time = 0;
this->_tls_handshake_end_time = 0;
+ this->_tls_handshake_bytes_in = 0;
+ this->_tls_handshake_bytes_out = 0;
+}
+
+bool
+TLSBasicSupport::get_tls_handshake_bytes(uint64_t &bytes_in, uint64_t
&bytes_out)
+{
+ if (_tls_handshake_bytes_in > 0 || _tls_handshake_bytes_out > 0) {
+ bytes_in = _tls_handshake_bytes_in;
+ bytes_out = _tls_handshake_bytes_out;
+ return false;
+ }
+
+ SSL *ssl = this->_get_ssl_object();
+ if (ssl == nullptr) {
+ bytes_in = 0;
+ bytes_out = 0;
+ return false;
+ }
+
+ BIO *rbio = SSL_get_rbio(ssl);
+ BIO *wbio = SSL_get_wbio(ssl);
+
+ uint64_t bio_in = rbio ? BIO_number_read(rbio) : 0;
+ uint64_t bio_out = wbio ? BIO_number_written(wbio) : 0;
+
+ bytes_in = _tls_handshake_bytes_in = bio_in;
+ bytes_out = _tls_handshake_bytes_out = bio_out;
+
+ return true;
Review Comment:
Shouldn't that first return return true? It set values.
Maybe this is intentional? We only return true the first time the BIO is
read? Regardless, let's add doxygen comments explaining the semantics of the
returned boolean.
--
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]