Skip to content

Commit ece3dca

Browse files
committed
JNI: Reset pollRx/pollTx flags at start of each I/O loop iteration
1 parent c5885ab commit ece3dca

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

native/com_wolfssl_WolfSSLSession.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,11 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_connect
10561056
}
10571057

10581058
do {
1059+
pollRx = 0;
1060+
#if !defined(WOLFJNI_USE_IO_SELECT) && !defined(USE_WINDOWS_API)
1061+
pollTx = 0;
1062+
#endif
1063+
10591064
/* get I/O lock */
10601065
if (wc_LockMutex(jniSessLock) != 0) {
10611066
ret = WOLFSSL_FAILURE;
@@ -1162,6 +1167,11 @@ static int SSLWriteNonblockingWithSelectPoll(WOLFSSL* ssl, byte* data,
11621167
}
11631168

11641169
do {
1170+
pollRx = 0;
1171+
#if !defined(WOLFJNI_USE_IO_SELECT) && !defined(USE_WINDOWS_API)
1172+
pollTx = 0;
1173+
#endif
1174+
11651175
/* lock mutex around session I/O before write attempt */
11661176
if (wc_LockMutex(jniSessLock) != 0) {
11671177
ret = WOLFSSL_FAILURE;
@@ -1381,6 +1391,11 @@ static int SSLReadNonblockingWithSelectPoll(WOLFSSL* ssl, byte* out,
13811391
}
13821392

13831393
do {
1394+
pollRx = 0;
1395+
#if !defined(WOLFJNI_USE_IO_SELECT) && !defined(USE_WINDOWS_API)
1396+
pollTx = 0;
1397+
#endif
1398+
13841399
/* lock mutex around session I/O before read attempt */
13851400
if (wc_LockMutex(jniSessLock) != 0) {
13861401
size = WOLFSSL_FAILURE;
@@ -1621,6 +1636,11 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_accept
16211636
}
16221637

16231638
do {
1639+
pollRx = 0;
1640+
#if !defined(WOLFJNI_USE_IO_SELECT) && !defined(USE_WINDOWS_API)
1641+
pollTx = 0;
1642+
#endif
1643+
16241644
/* get I/O lock */
16251645
if (wc_LockMutex(jniSessLock) != 0) {
16261646
ret = WOLFSSL_FAILURE;
@@ -1910,6 +1930,11 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_shutdownSSL
19101930
}
19111931

19121932
do {
1933+
pollRx = 0;
1934+
#if !defined(WOLFJNI_USE_IO_SELECT) && !defined(USE_WINDOWS_API)
1935+
pollTx = 0;
1936+
#endif
1937+
19131938
/* get I/O lock */
19141939
if (wc_LockMutex(jniSessLock) != 0) {
19151940
ret = WOLFSSL_FAILURE;

0 commit comments

Comments
 (0)