[svn-commits] dbailey: branch 1.4 r82887 - /branches/1.4/main/manager.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Sep 18 16:10:15 CDT 2007


Author: dbailey
Date: Tue Sep 18 16:10:14 2007
New Revision: 82887

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82887
Log:
Fixed a bug where http manager sessions prevented the eventq from being cleaned out because http manager sessions do not have a valid file descriptor.

Modified:
    branches/1.4/main/manager.c

Modified: branches/1.4/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/manager.c?view=diff&rev=82887&r1=82886&r2=82887
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Tue Sep 18 16:10:14 2007
@@ -1976,19 +1976,25 @@
 	struct eventqent *eqe;
 	int ret = 0;
 	ast_mutex_lock(&s->__lock);
-	if (s->fd > -1) {
-		if (!s->eventq)
-			s->eventq = master_eventq;
-		while(s->eventq->next) {
-			eqe = s->eventq->next;
-			if ((s->authenticated && (s->readperm & eqe->category) == eqe->category) &&
-			    ((s->send_events & eqe->category) == eqe->category)) {
+	if (!s->eventq)
+		s->eventq = master_eventq;
+	while(s->eventq->next) {
+		eqe = s->eventq->next;
+		if ((s->authenticated && (s->readperm & eqe->category) == eqe->category) &&
+				   ((s->send_events & eqe->category) == eqe->category)) {
+			if (s->fd > -1) {
 				if (!ret && ast_carefulwrite(s->fd, eqe->eventdata, strlen(eqe->eventdata), s->writetimeout) < 0)
 					ret = -1;
+			} else {
+				if (!s->outputstr && !(s->outputstr = ast_calloc(1, sizeof(*s->outputstr)))) {
+					ast_mutex_unlock(&s->__lock);
+					return;
+				}
+				ast_dynamic_str_append(&s->outputstr, 0, "%s", buf->str);
 			}
-			unuse_eventqent(s->eventq);
-			s->eventq = eqe;
-		}
+				   }
+				   unuse_eventqent(s->eventq);
+				   s->eventq = eqe;
 	}
 	ast_mutex_unlock(&s->__lock);
 	return ret;




More information about the svn-commits mailing list