[asterisk-dev] proposed change to main/http.c

Luigi Rizzo rizzo at icir.org
Thu Oct 5 14:17:25 MST 2006


Any objection to this change ? Without it, at least on FreeBSD the
socket used for receiving incoming http request is non blocking and
it basically fails to handle requests because the fgets call returns
immediately with an empty buffer.

It shouldn't harm on linux either, as the socket should really
be blocking to make input processing correct and efficient

	cheers
	luigi

> svn diff main/http.c
Index: main/http.c
===================================================================
--- main/http.c (revision 44516)
+++ main/http.c (working copy)
@@ -504,6 +504,8 @@
                }
                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+"))) {



More information about the asterisk-dev mailing list