[svn-commits] rizzo: trunk r45690 - /trunk/main/manager.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Oct 19 10:07:08 MST 2006


Author: rizzo
Date: Thu Oct 19 12:07:08 2006
New Revision: 45690

URL: http://svn.digium.com/view/asterisk?rev=45690&view=rev
Log:
implement proper XML/HTML formatting of multiple messages
(e.g. the result of waitevent).

Also fix some comments.


Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?rev=45690&r1=45689&r2=45690&view=diff
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Thu Oct 19 12:07:08 2006
@@ -83,10 +83,6 @@
 	char eventdata[1];	/* really variable size, allocated by append_event() */
 };
 struct eventqent *master_eventq = NULL; /* Protected by the sessions list lock */
-/*
- * XXX for some unclear reasons, we make sure master_eventq always
- * has one event in it (Placeholder) in init_manager().
- */
 
 static int enabled = 0;
 static int portno = DEFAULT_MANAGER_PORT;
@@ -505,7 +501,6 @@
  * (why check for e->next ?) wakeup the
  * main thread, which is in charge of freeing the record.
  * Returns the next record.
- * XXX Locking assumptions ??? next may change if we are last.
  */
 static struct eventqent *unref_event(struct eventqent *e)
 {
@@ -991,10 +986,10 @@
 		ast_mutex_unlock(&s->__lock);
 		if (needexit)
 			break;
-		if (!s->inuse && s->fd > 0) {
+		if (!s->inuse && s->fd > 0) {	/* AMI session */
 			if (ast_wait_for_input(s->fd, 1000))
 				break;
-		} else {
+		} else {	/* HTTP session */
 			sleep(1);
 		}
 	}
@@ -2022,7 +2017,6 @@
 /*
  * events are appended to a queue from where they
  * can be dispatched to clients.
- * Must be called with the session lock held (or equivalent).
  */
 static int append_event(const char *str, int category)
 {
@@ -2356,8 +2350,9 @@
 	tmp = out;
 	/* we want to stop when we find an empty line */
 	while (in && *in) {
-		in = ast_skip_blanks(in);	/* trailing \n from before */
 		val = strsep(&in, "\r\n");	/* mark start and end of line */
+		if (in && *in == '\n')		/* remove trailing \n if any */
+			in++;
 		ast_trim_blanks(val);
 		ast_verbose("inobj %d in_data %d line <%s>\n", inobj, in_data, val);
 		if (ast_strlen_zero(val)) {



More information about the svn-commits mailing list