Skip to content

Commit 42d210e

Browse files
Merge pull request #67 from cconlon/timeout
fix socketSelect setting of timeout sec/usec
2 parents a1eb370 + de084ea commit 42d210e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

native/com_wolfssl_WolfSSLSession.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <stdio.h>
2323
#include <stdint.h>
24+
#include <sys/time.h>
2425

2526
#include <arpa/inet.h>
2627
#include <wolfssl/options.h>
@@ -469,8 +470,11 @@ static int socketSelect(int sockfd, int timeout_ms, int rx)
469470
fd_set* recvfds = NULL;
470471
fd_set* sendfds = NULL;
471472
int nfds = sockfd + 1;
472-
struct timeval timeout = {(timeout_ms > 0) ? timeout_ms / 1000 : 0, 0};
473473
int result;
474+
struct timeval timeout;
475+
476+
timeout.tv_sec = timeout_ms / 1000;
477+
timeout.tv_usec = (timeout_ms % 1000) * 1000;
474478

475479
FD_ZERO(&fds);
476480
FD_SET(sockfd, &fds);

0 commit comments

Comments
 (0)