dect
/
asterisk
Archived
13
0
Fork 0

make sure sockets are blocking when they should be blocking.

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44568 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
rizzo 2006-10-06 15:59:57 +00:00
parent 7db4ea326c
commit d70733010d
2 changed files with 5 additions and 0 deletions

View File

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

View File

@ -2157,6 +2157,9 @@ static void *accept_thread(void *ignore)
/* For safety, make sure socket is non-blocking */
flags = fcntl(as, F_GETFL);
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);
s->fd = as;