| 584 | } |
| 585 | |
| 586 | void TSSLSocket::flush() { |
| 587 | resetConsumedMessageSize(); |
| 588 | // Don't throw exception if not open. Thrift servers close socket twice. |
| 589 | if (ssl_ == nullptr) { |
| 590 | return; |
| 591 | } |
| 592 | initializeHandshake(); |
| 593 | if (!checkHandshake()) |
| 594 | throw TSSLException("BIO_flush: Handshake is not completed"); |
| 595 | BIO* bio = SSL_get_wbio(ssl_); |
| 596 | if (bio == nullptr) { |
| 597 | throw TSSLException("SSL_get_wbio returns nullptr"); |
| 598 | } |
| 599 | if (BIO_flush(bio) != 1) { |
| 600 | int errno_copy = THRIFT_GET_SOCKET_ERROR; |
| 601 | string errors; |
| 602 | buildErrors(errors, errno_copy); |
| 603 | throw TSSLException("BIO_flush: " + errors); |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | void TSSLSocket::initializeHandshakeParams() { |
| 608 | // set underlying socket to non-blocking |