Process the return code received from OpenSSL> * Update the want parameter with expected I/O. * Update the connection's error state if a real error has occured. * Returns an SSL error code, or 0 if no further handling is required. */
| 744 | * Returns an SSL error code, or 0 if no further handling is required. |
| 745 | */ |
| 746 | static int handleSSLReturnCode(tls_connection *conn, int ret_value, WantIOType *want) { |
| 747 | if (ret_value <= 0) { |
| 748 | int ssl_err = SSL_get_error(conn->ssl, ret_value); |
| 749 | switch (ssl_err) { |
| 750 | case SSL_ERROR_WANT_WRITE: |
| 751 | *want = WANT_WRITE; |
| 752 | return 0; |
| 753 | case SSL_ERROR_WANT_READ: |
| 754 | *want = WANT_READ; |
| 755 | return 0; |
| 756 | case SSL_ERROR_SYSCALL: |
| 757 | conn->c.last_errno = errno; |
| 758 | if (conn->ssl_error) zfree(conn->ssl_error); |
| 759 | conn->ssl_error = errno ? zstrdup(strerror(errno)) : NULL; |
| 760 | break; |
| 761 | default: |
| 762 | /* Error! */ |
| 763 | updateTLSError(conn); |
| 764 | break; |
| 765 | } |
| 766 | |
| 767 | return ssl_err; |
| 768 | } |
| 769 | |
| 770 | return 0; |
| 771 | } |
| 772 | |
| 773 | void registerSSLEvent(tls_connection *conn, WantIOType want) { |
| 774 | int mask = aeGetFileEvents(serverTL->el, conn->c.fd); |
no test coverage detected