aboutsummaryrefslogtreecommitdiffstats
path: root/manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'manager.c')
-rwxr-xr-xmanager.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/manager.c b/manager.c
index fe8d2769b..ed285ec69 100755
--- a/manager.c
+++ b/manager.c
@@ -727,6 +727,7 @@ static void *accept_thread(void *ignore)
struct mansession *s;
struct protoent *p;
int arg = 1;
+ int flags;
pthread_attr_t attr;
pthread_attr_init(&attr);
@@ -752,6 +753,9 @@ static void *accept_thread(void *ignore)
}
memset(s, 0, sizeof(struct mansession));
memcpy(&s->sin, &sin, sizeof(sin));
+ /* For safety, make sure socket is non-blocking */
+ flags = fcntl(as, F_GETFL);
+ fcntl(as, F_SETFL, flags | O_NONBLOCK);
ast_mutex_init(&s->lock);
s->fd = as;
ast_mutex_lock(&sessionlock);