Skip to content

Commit 4395d7a

Browse files
committed
JNI/JSSE: use select() for Windows since no poll() available
1 parent 55c3193 commit 4395d7a

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

native/com_wolfssl_WolfSSLSession.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
#include <sys/time.h>
3333
#include <arpa/inet.h>
3434
#include <sys/errno.h>
35-
#endif
36-
#ifdef WOLFJNI_USE_IO_SELECT
37-
#include <sys/select.h>
38-
#else
39-
#include <poll.h>
35+
#if defined(WOLFJNI_USE_IO_SELECT)
36+
#include <sys/select.h>
37+
#else
38+
#include <poll.h>
39+
#endif
4040
#endif
4141

4242
#ifndef WOLFSSL_JNI_DEFAULT_PEEK_TIMEOUT
@@ -615,7 +615,8 @@ enum {
615615
WOLFJNI_IO_EVENT_INVALID_TIMEOUT = -17
616616
};
617617

618-
#ifdef WOLFJNI_USE_IO_SELECT
618+
/* Windows doesn't have poll(), use select() */
619+
#if defined(WOLFJNI_USE_IO_SELECT) || defined(USE_WINDOWS_API)
619620

620621
/* Perform a select() call on the underlying socket to wait for socket to be
621622
* ready for read/write, or timeout. Note that we explicitly set the underlying
@@ -787,7 +788,7 @@ static int socketPoll(int sockfd, int timeout_ms, int rx, int tx)
787788
return WOLFJNI_IO_EVENT_FAIL;
788789
}
789790

790-
#endif /* WOLFJNI_USE_IO_SELECT */
791+
#endif /* WOLFJNI_USE_IO_SELECT | USE_WINDOWS_API */
791792

792793
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_connect
793794
(JNIEnv* jenv, jobject jcl, jlong sslPtr, jint timeout)

0 commit comments

Comments
 (0)