Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: BIO_set_retry_write when BIO_CTRL_FLUSH to allow writer returns WouldBlock on flush #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ihciah
Copy link

@ihciah ihciah commented May 11, 2023

A fix for rust-openssl can be found at sfackler/rust-openssl#1922

This PR fixes a BIO_flush related issue. According to openssl doc(link):

BIO_flush(), because it can write data may return 0 or -1 indicating that the call should be retried later in a similar manner to BIO_write(). The BIO_should_retry() call should be used and appropriate action taken is the call fails.

We have to call BIO_set_retry_write on retriable_error like WouldBlock. Otherwise, when the flush returns WouldBlock, it will fail.

Since we usually wrap openssl with a TcpStream, there is no buffer inside and flush always returns Ok(()), this issue is not obvious. However, if users use a buffered io, the flush support will be essential.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant