Latest update (add quic)
This commit is contained in:
+2
-34
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "bio_local.h"
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
# define SOCKET_PROTOCOL IPPROTO_TCP
|
||||
@@ -23,13 +24,6 @@
|
||||
static int wsa_init_done = 0;
|
||||
# endif
|
||||
|
||||
# ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
# include <sys/select.h>
|
||||
# else
|
||||
# include <winsock.h> /* for type fd_set */
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
int BIO_get_host_ip(const char *str, unsigned char *ip)
|
||||
{
|
||||
@@ -375,30 +369,4 @@ int BIO_sock_info(int sock,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* TODO simplify by BIO_socket_wait() further other uses of select() in apps/ */
|
||||
/*
|
||||
* Wait on fd at most until max_time; succeed immediately if max_time == 0.
|
||||
* If for_read == 0 then assume to wait for writing, else wait for reading.
|
||||
* Returns -1 on error, 0 on timeout, and 1 on success.
|
||||
*/
|
||||
int BIO_socket_wait(int fd, int for_read, time_t max_time)
|
||||
{
|
||||
fd_set confds;
|
||||
struct timeval tv;
|
||||
time_t now;
|
||||
|
||||
if (max_time == 0)
|
||||
return 1;
|
||||
|
||||
now = time(NULL);
|
||||
if (max_time <= now)
|
||||
return 0;
|
||||
|
||||
FD_ZERO(&confds);
|
||||
openssl_fdset(fd, &confds);
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = (long)(max_time - now); /* might overflow */
|
||||
return select(fd + 1, for_read ? &confds : NULL,
|
||||
for_read ? NULL : &confds, NULL, &tv);
|
||||
}
|
||||
#endif /* !defined(OPENSSL_NO_SOCK) */
|
||||
#endif
|
||||
Reference in New Issue
Block a user