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

read returns error value to timeout #210

Merged
merged 1 commit into from
Jul 19, 2024
Merged

Conversation

rlm2002
Copy link

@rlm2002 rlm2002 commented Jul 18, 2024

Java_com_wolfssl_WolfSSLSession_read() returns error value of socketPoll() if encountered. Originally breaks and returns size.

@@ -1090,7 +1090,7 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_read
ret == WOLFJNI_IO_EVENT_FAIL) {
/* Java will throw SocketTimeoutException or
* SocketException */
break;
return ret;
Copy link
Member

Choose a reason for hiding this comment

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

We can't return directly here since we need to drop down and call ReleaseByteArrayElements() below the while loop.

We can do:

size = ret;
break;

But, since that's the same as the "else" block below it, we should consolodate the two together. I recommend one "else" block that does the above, but adjust the code comment inside the else to include that Java will throw SocketTimeoutException or SocketException in the case of WOLFJNI_IO_EVENT_TIMEOUT, WOLFJNI_IO_EVENT_FD_CLOSED, WOLFJNI_IO_EVENT_ERROR, WOLFJNI_IO_EVENT_POLLHUP, and WOLFJNI_IO_EVENT_FAIL.

@cconlon cconlon removed their assignment Jul 19, 2024
@cconlon cconlon merged commit 13da2b0 into wolfSSL:master Jul 19, 2024
35 checks passed
@rlm2002 rlm2002 deleted the timeouts branch July 25, 2024 18:12
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