make sure sockets are blocking when they should be blocking.
authorLuigi Rizzo <rizzo@icir.org>
Fri, 6 Oct 2006 15:59:57 +0000 (15:59 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Fri, 6 Oct 2006 15:59:57 +0000 (15:59 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44568 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/http.c
main/manager.c

index 0a78446..d56f098 100644 (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+"))) {
index 2f3f1c5..f0fa640 100644 (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;