summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-11-18 22:14:20 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-11-18 22:14:20 +0000
commitb3867180cf85c4e4dcbf2e9754ddde837c42a698 (patch)
tree5b3de8139b346b72a69bb8657a39ba66fbbece09
parent49d03906b6da64236fe44bda1d49e56096b5ea1a (diff)
comments-only change:
document a bit more when manager events are delivered to the clients. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/manager.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/main/manager.c b/main/manager.c
index 80cfb07ad..e65317edd 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1902,6 +1902,9 @@ static int action_timeout(struct mansession *s, struct message *m)
return 0;
}
+/*!
+ * Send any applicable events to the client listening on this socket
+ */
static int process_events(struct mansession *s)
{
int ret = 0;
@@ -1994,6 +1997,7 @@ static int process_message(struct mansession *s, struct message *m)
astman_send_error(s, m, "Invalid/unknown command");
if (ret)
return ret;
+ /* Once done with our message, deliver any pending events */
return process_events(s);
}
@@ -2046,6 +2050,9 @@ static int get_input(struct mansession *s, char *output)
ast_mutex_unlock(&s->__lock);
}
if (res < 0) {
+ /* If we get a signal from some other thread (typically because
+ * there are new events queued), return 0 to notify the caller.
+ */
if (errno == EINTR)
return 0;
ast_log(LOG_WARNING, "poll() returned error: %s\n", strerror(errno));
@@ -2065,6 +2072,12 @@ static int get_input(struct mansession *s, char *output)
}
/*! \brief The body of the individual manager session.
+ * Call get_input() to read one line at a time
+ * (or be woken up on new events), collect the lines in a
+ * message until found an empty line, and execute the request.
+ * In any case, deliver events asynchronously through process_events()
+ * (called from here if no line is available, or at the end of
+ * process_message(). )
*/
static void *session_do(void *data)
{