Return true if we updated the rbio with another memory chunk (should be ready for another read right away)
| 427 | // memory chunk (should be ready for another read right away) |
| 428 | // |
| 429 | bool |
| 430 | SSLNetVConnection::update_rbio(bool move_to_socket) |
| 431 | { |
| 432 | bool retval = false; |
| 433 | if (BIO_eof(SSL_get_rbio(this->ssl)) && this->handShakeReader != nullptr) { |
| 434 | Dbg(dbg_ctl_ssl, "Consuming handShakeBioStored=%d bytes from the handshake reader", this->handShakeBioStored); |
| 435 | this->handShakeReader->consume(this->handShakeBioStored); |
| 436 | this->handShakeBioStored = 0; |
| 437 | // Load up the next block if present |
| 438 | if (this->handShakeReader->is_read_avail_more_than(0)) { |
| 439 | auto const total_chain_size = this->handShakeReader->read_avail(); |
| 440 | this->handShakeBioStored = total_chain_size; |
| 441 | char *buffer_for_bio = this->_getCoalescedHandShakeBuffer(total_chain_size); |
| 442 | Dbg(dbg_ctl_ssl, "Adding %d bytes to the ssl rbio", this->handShakeBioStored); |
| 443 | |
| 444 | // Sets up the buffer as a read only bio target |
| 445 | // Must be reset on each read |
| 446 | BIO *rbio = BIO_new_mem_buf(buffer_for_bio, this->handShakeBioStored); |
| 447 | BIO_set_mem_eof_return(rbio, -1); |
| 448 | SSL_set0_rbio(this->ssl, rbio); |
| 449 | retval = true; |
| 450 | // Handshake buffer is empty but we have read something, move to the socket rbio |
| 451 | } else if (move_to_socket && this->handShakeHolder->is_read_avail_more_than(0)) { |
| 452 | Dbg(dbg_ctl_ssl, "No other bytes in the handshake reader, moving to socket rbio"); |
| 453 | BIO *rbio = BIO_new_socket(this->get_socket(), BIO_NOCLOSE); |
| 454 | BIO_set_mem_eof_return(rbio, -1); |
| 455 | SSL_set0_rbio(this->ssl, rbio); |
| 456 | free_handshake_buffers(); |
| 457 | } |
| 458 | } |
| 459 | return retval; |
| 460 | } |
| 461 | |
| 462 | // changed by YTS Team, yamsat |
| 463 | void |
nothing calls this directly
no test coverage detected