|
|
@ -29,6 +29,7 @@ |
|
|
|
#include <sys/time.h> |
|
|
|
#include <sys/time.h> |
|
|
|
#include <time.h> |
|
|
|
#include <time.h> |
|
|
|
#include <math.h> |
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
#include <poll.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "libckpool.h" |
|
|
|
#include "libckpool.h" |
|
|
|
#include "sha2.h" |
|
|
|
#include "sha2.h" |
|
|
@ -704,17 +705,17 @@ out: |
|
|
|
return sockd; |
|
|
|
return sockd; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Emulate a select read wait for high fds that select doesn't support */ |
|
|
|
int wait_read_select(int sockd, int timeout) |
|
|
|
int wait_read_select(int sockd, int timeout) |
|
|
|
{ |
|
|
|
{ |
|
|
|
tv_t tv_timeout; |
|
|
|
struct pollfd sfd; |
|
|
|
fd_set readfs; |
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
tv_timeout.tv_sec = timeout; |
|
|
|
|
|
|
|
tv_timeout.tv_usec = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO(&readfs); |
|
|
|
sfd.fd = sockd; |
|
|
|
FD_SET(sockd, &readfs); |
|
|
|
sfd.events = POLLIN; |
|
|
|
return select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); |
|
|
|
sfd.revents = 0; |
|
|
|
|
|
|
|
timeout *= 1000; |
|
|
|
|
|
|
|
return poll(&sfd, 1, timeout); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int read_length(int sockd, void *buf, int len) |
|
|
|
int read_length(int sockd, void *buf, int len) |
|
|
@ -778,17 +779,17 @@ out: |
|
|
|
return buf; |
|
|
|
return buf; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Emulate a select write wait for high fds that select doesn't support */ |
|
|
|
int wait_write_select(int sockd, int timeout) |
|
|
|
int wait_write_select(int sockd, int timeout) |
|
|
|
{ |
|
|
|
{ |
|
|
|
tv_t tv_timeout; |
|
|
|
struct pollfd sfd; |
|
|
|
fd_set writefds; |
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
tv_timeout.tv_sec = timeout; |
|
|
|
|
|
|
|
tv_timeout.tv_usec = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO(&writefds); |
|
|
|
sfd.fd = sockd; |
|
|
|
FD_SET(sockd, &writefds); |
|
|
|
sfd.events = POLLOUT; |
|
|
|
return select(sockd + 1, NULL, &writefds, NULL, &tv_timeout); |
|
|
|
sfd.revents = 0; |
|
|
|
|
|
|
|
timeout *= 1000; |
|
|
|
|
|
|
|
return poll(&sfd, 1, timeout); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int write_length(int sockd, const void *buf, int len) |
|
|
|
int write_length(int sockd, const void *buf, int len) |
|
|
|