websocket test: make client sockets non-blocking

master
Jessie Murray 3 years ago
parent 8141c00ab7
commit 9a758c6bcf
No known key found for this signature in database
GPG Key ID: E7E4D57EDDA744C5

@ -10,6 +10,7 @@
#include <errno.h>
#include <ctype.h>
#include <getopt.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
@ -339,6 +340,7 @@ worker_main(void *ptr) {
int ret;
int fd;
int int_one = 1;
struct sockaddr_in addr;
struct timeval timeout_tv;
struct event *timeout_ev;
@ -355,6 +357,11 @@ worker_main(void *ptr) {
fprintf(stderr, "connect: ret=%d: %s\n", ret, strerror(errno));
return NULL;
}
ret = ioctl(fd, FIONBIO, &int_one);
if (ret != 0) {
fprintf(stderr, "ioctl: ret=%d: %s\n", ret, strerror(errno));
return NULL;
}
/* initialize worker thread */
wt->fd = fd;

Loading…
Cancel
Save