[Asterisk-cvs] asterisk manager.c,1.96,1.97

russell at lists.digium.com russell at lists.digium.com
Tue May 17 14:25:34 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv32014

Modified Files:
	manager.c 
Log Message:
remove call to pall on unitialied fds
This function assumes that the fd is nonblocking (bug #4053)


Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- manager.c	15 May 2005 03:21:51 -0000	1.96
+++ manager.c	17 May 2005 18:30:44 -0000	1.97
@@ -87,6 +87,10 @@
 static struct manager_action *first_action = NULL;
 AST_MUTEX_DEFINE_STATIC(actionlock);
 
+/* If you are calling carefulwrite, it is assumed that you are calling
+   it on a file descriptor that _DOES_ have NONBLOCK set.  This way,
+   there is only one system call made to do a write, unless we actually
+   have a need to wait.  This way, we get better performance. */
 int ast_carefulwrite(int fd, char *s, int len, int timeoutms) 
 {
 	/* Try to write string, but wait no more than ms milliseconds
@@ -94,10 +98,6 @@
 	int res=0;
 	struct pollfd fds[1];
 	while(len) {
-		/* Wait until writable */
-		res = poll(fds, 1, timeoutms);
-		if (res < 1)
-			return -1;
 		res = write(fd, s, len);
 		if ((res < 0) && (errno != EAGAIN)) {
 			return -1;




More information about the svn-commits mailing list