make sure sockets are blocking when they should be blocking.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Luigi Rizzo 19 years ago
parent ccca5843fd
commit 3f641c6048

@ -504,6 +504,8 @@ static void *http_root(void *data)
} }
ser = ast_calloc(1, sizeof(*ser)); ser = ast_calloc(1, sizeof(*ser));
if (ser) { if (ser) {
int flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
ser->fd = fd; ser->fd = fd;
memcpy(&ser->requestor, &sin, sizeof(ser->requestor)); memcpy(&ser->requestor, &sin, sizeof(ser->requestor));
if ((ser->f = fdopen(ser->fd, "w+"))) { if ((ser->f = fdopen(ser->fd, "w+"))) {

@ -2157,6 +2157,9 @@ static void *accept_thread(void *ignore)
/* For safety, make sure socket is non-blocking */ /* For safety, make sure socket is non-blocking */
flags = fcntl(as, F_GETFL); flags = fcntl(as, F_GETFL);
fcntl(as, F_SETFL, flags | O_NONBLOCK); fcntl(as, F_SETFL, flags | O_NONBLOCK);
} else {
flags = fcntl(as, F_GETFL);
fcntl(as, F_SETFL, flags & ~O_NONBLOCK);
} }
ast_mutex_init(&s->__lock); ast_mutex_init(&s->__lock);
s->fd = as; s->fd = as;

Loading…
Cancel
Save