Skip to content

SSL non blocking read#10

Open
DenisRazinkin wants to merge 6 commits intomasterfrom
ssl-non-blocking-read
Open

SSL non blocking read#10
DenisRazinkin wants to merge 6 commits intomasterfrom
ssl-non-blocking-read

Conversation

@DenisRazinkin
Copy link
Collaborator


Note: by creating a PR or an issue you automatically agree to the CLA. See CONTRIBUTING.md. Feel free to remove this note, the agreement holds.

auto tls_client = io::TlsWrapper::StartTlsClient(std::move(client), {}, test_deadline);

char c = 0;
std::optional<size_t> read_bytes = tls_client.RecvAll(&c, 1, test_deadline);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RecvAll returns size_t, so no need in optional.

@@ -595,6 +635,7 @@ bool TlsWrapper::WaitWriteable(Deadline deadline) {
return impl_->bio_data.socket.WaitWriteable(deadline);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double empty line

const char* context
) {
UASSERT(ssl);
if (!len) return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It breaks the contracts as it says optional{0} for connection ended

if (!len) return 0;

char* const begin = static_cast<char*>(buf);
char* const end = begin + len;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we use end only to calculate back the len. So it's better to use len directly


bio_data.current_deadline = Deadline::Passed();

const int io_ret = io_func(ssl.get(), begin, end - begin, &chunk_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we restrict io_func to a specific signature, it's better to use pointer, not template

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this in the manner of existing PerformSslIo and would change it for consistency

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.

3 participants