You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/06/23 19:56:57 UTC
[trafficserver] branch 7.1.x updated: Convert an ink_release_assert
into logic to reset the rbio to use the remaining data.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new f2abdf8 Convert an ink_release_assert into logic to reset the rbio to use the remaining data.
f2abdf8 is described below
commit f2abdf899e54772c324e1dce7454960f7848f518
Author: Susan Hinrichs <sh...@ieee.org>
AuthorDate: Thu Jun 15 21:06:31 2017 +0000
Convert an ink_release_assert into logic to reset the rbio to use the remaining data.
Tidy up the fix and reduce cut-n-paste.
(cherry picked from commit 2a112d0eda562c705c2621d1b6fbc5bf3218fc75)
Conflicts:
iocore/net/SSLNetVConnection.cc
---
iocore/net/P_SSLNetVConnection.h | 1 +
iocore/net/SSLNetVConnection.cc | 80 ++++++++++++++++++++--------------------
2 files changed, 42 insertions(+), 39 deletions(-)
diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h
index 4f0c525..1878400 100644
--- a/iocore/net/P_SSLNetVConnection.h
+++ b/iocore/net/P_SSLNetVConnection.h
@@ -265,6 +265,7 @@ private:
SSLNetVConnection &operator=(const SSLNetVConnection &);
ts::StringView map_tls_protocol_to_tag(const char *proto_string) const;
+ bool update_rbio(bool move_to_socket);
bool sslHandShakeComplete;
bool sslClientRenegotiationAbort;
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 35f4009..27d4fec 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -385,6 +385,40 @@ SSLNetVConnection::read_raw_data()
return r;
}
+//
+// Return true if we updated the rbio with another
+// memory chunk (should be ready for another read right away)
+//
+bool
+SSLNetVConnection::update_rbio(bool move_to_socket)
+{
+ bool retval = false;
+ if (BIO_eof(SSL_get_rbio(this->ssl))) {
+ this->handShakeReader->consume(this->handShakeBioStored);
+ this->handShakeBioStored = 0;
+ // Load up the next block if present
+ if (this->handShakeReader->is_read_avail_more_than(0)) {
+ // Setup the next iobuffer block to drain
+ char *start = this->handShakeReader->start();
+ char *end = this->handShakeReader->end();
+ this->handShakeBioStored = end - start;
+
+ // Sets up the buffer as a read only bio target
+ // Must be reset on each read
+ BIO *rbio = BIO_new_mem_buf(start, this->handShakeBioStored);
+ BIO_set_mem_eof_return(rbio, -1);
+ SSL_set0_rbio(this->ssl, rbio);
+ retval = true;
+ } else if (move_to_socket) { // Handshake buffer is empty, move to the socket rbio
+ BIO *rbio = BIO_new_fd(this->get_socket(), BIO_NOCLOSE);
+ BIO_set_mem_eof_return(rbio, -1);
+ SSL_set0_rbio(this->ssl, rbio);
+ free_handshake_buffers();
+ }
+ }
+ return retval;
+}
+
// changed by YTS Team, yamsat
void
SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
@@ -444,23 +478,7 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
if (this->handShakeReader) {
if (this->attributes != HttpProxyPort::TRANSPORT_BLIND_TUNNEL) {
// Check and consume data that has been read
- if (BIO_eof(SSL_get_rbio(this->ssl))) {
- this->handShakeReader->consume(this->handShakeBioStored);
- this->handShakeBioStored = 0;
- // Load up the next block if present
- if (this->handShakeReader->is_read_avail_more_than(0)) {
- // Setup the next iobuffer block to drain
- char *start = this->handShakeReader->start();
- char *end = this->handShakeReader->end();
- this->handShakeBioStored = end - start;
-
- // Sets up the buffer as a read only bio target
- // Must be reset on each read
- BIO *rbio = BIO_new_mem_buf(start, this->handShakeBioStored);
- BIO_set_mem_eof_return(rbio, -1);
- SSL_set0_rbio(this->ssl, rbio);
- }
- }
+ update_rbio(false);
} else {
// Now in blind tunnel. Set things up to read what is in the buffer
// Must send the READ_COMPLETE here before considering
@@ -514,17 +532,14 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
}
// move over to the socket if we haven't already
if (this->handShakeBuffer) {
- ink_release_assert(BIO_eof(SSL_get_rbio(this->ssl)) && !handShakeReader->is_read_avail_more_than(0));
- // Done with the buffer after the first exchange, convert over to the socket buffer
- BIO *rbio = BIO_new_fd(this->get_socket(), BIO_NOCLOSE);
- BIO_set_mem_eof_return(rbio, -1);
- SSL_set0_rbio(this->ssl, rbio);
- free_handshake_buffers();
+ read.triggered = update_rbio(true);
} else {
Debug("ssl", "Want read from socket");
+ read.triggered = 0;
+ }
+ if (!read.triggered) {
+ nh->read_ready_list.remove(this);
}
- read.triggered = 0;
- nh->read_ready_list.remove(this);
readReschedule(nh);
} else if (ret == SSL_HANDSHAKE_WANT_CONNECT || ret == SSL_HANDSHAKE_WANT_WRITE) {
write.triggered = 0;
@@ -1086,20 +1101,7 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
return EVENT_ERROR;
}
} else {
- this->handShakeReader->consume(this->handShakeBioStored);
- this->handShakeBioStored = 0;
- // There is more data in the buffer, reset the memory buffer
- if (this->handShakeReader->is_read_avail_more_than(0)) {
- char *start = this->handShakeReader->start();
- char *end = this->handShakeReader->end();
- this->handShakeBioStored = end - start;
-
- // Sets up the buffer as a read only bio target
- // Must be reset on each read
- BIO *rbio = BIO_new_mem_buf(start, this->handShakeBioStored);
- BIO_set_mem_eof_return(rbio, -1);
- SSL_set0_rbio(this->ssl, rbio);
- }
+ update_rbio(false);
}
} // Still data in the BIO
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].