From f24ec459b2f4351fea36db88f6911fd9dbde5ffe Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Fri, 6 Oct 2006 15:59:23 +0000 Subject: [PATCH] make sure sockets are blocking when they should be blocking. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@44567 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/http.c | 2 ++ main/manager.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/main/http.c b/main/http.c index e761631055..1b7e08a665 100644 --- a/main/http.c +++ b/main/http.c @@ -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+"))) { diff --git a/main/manager.c b/main/manager.c index ca2bd68fb2..12e107ab42 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2181,6 +2181,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;