more indentation cleanup from previous commits,

and remove the "busy" field from struct mansession
as it was not used correctly anyways.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-10-18 13:42:14 +00:00
parent 46b5c26399
commit df06a40b05

View File

@@ -154,8 +154,6 @@ struct mansession {
struct sockaddr_in sin;
/*! TCP socket */
int fd;
/*! Whether or not we're busy doing an action XXX currently useless */
int busy;
/*! Whether an HTTP manager is in use */
int inuse;
/*! Whether an HTTP session should be destroyed */
@@ -1148,8 +1146,6 @@ static int action_waitevent(struct mansession *s, struct message *m)
if (!s->send_events)
s->send_events = -1;
/* Once waitevent is called, always queue events from now on */
if (s->busy == 1)
s->busy = 2;
}
ast_mutex_unlock(&s->__lock);
s->waiting_thread = pthread_self();
@@ -1895,7 +1891,6 @@ static int process_events(struct mansession *s)
if (s->fd > -1) {
struct eventqent *eqe;
s->busy--;
if (!s->eventq)
s->eventq = master_eventq;
while( (eqe = s->eventq->next) ) {
@@ -1956,7 +1951,6 @@ static int process_message(struct mansession *s, struct message *m)
return 0;
}
ast_atomic_fetchadd_int(&s->busy, 1); /* XXX what's for ? */
/* XXX should we protect the list navigation ? */
for (tmp = first_action ; tmp; tmp = tmp->next) {
if (!strcasecmp(action, tmp->action)) {
@@ -2367,7 +2361,6 @@ static char *generic_http_callback(enum output_format format,
struct mansession *s = NULL;
unsigned long ident = 0;
char workspace[1024];
char cookie[128];
size_t len = sizeof(workspace);
int blastaway = 0;
char *c = workspace;
@@ -2419,22 +2412,29 @@ static char *generic_http_callback(enum output_format format,
memset(&m, 0, sizeof(m));
{
char tmp[80];
char cookie[128];
ast_build_string(&c, &len, "Content-type: text/%s\r\n", contenttype[format]);
sprintf(tmp, "%08lx", s->managerid);
ast_build_string(&c, &len, "%s\r\n", ast_http_setcookie("mansession_id", tmp, httptimeout, cookie, sizeof(cookie)));
}
if (format == FORMAT_HTML)
ast_build_string(&c, &len, "<title>Asterisk&trade; Manager Test Interface</title>");
vars2msg(&m, params);
if (format == FORMAT_XML) {
ast_build_string(&c, &len, "<ajax-response>\n");
} else if (format == FORMAT_HTML) {
#define ROW_FMT "<tr><td colspan=\"2\" bgcolor=\"#f1f1ff\">%s</td></tr>\r\n"
#define TEST_STRING \
"<form action=\"manager\">action: <input name=\"action\"> cmd <input name=\"command\"><br>\
user <input name=\"username\"> pass <input type=\"password\" name=\"secret\"><br>
<input type=\"submit\"></form>"
ast_build_string(&c, &len, "<body bgcolor=\"#ffffff\"><table align=center bgcolor=\"#f1f1f1\" width=\"500\">\r\n");
ast_build_string(&c, &len, ROW_FMT, "<h1>&nbsp;&nbsp;Manager Tester</h1>");
ast_build_string(&c, &len, ROW_FMT, "<h1>Manager Tester</h1>");
ast_build_string(&c, &len, ROW_FMT, TEST_STRING);
}
{
@@ -2503,7 +2503,7 @@ static char *generic_http_callback(enum output_format format,
ast_build_string(&c, &len, "</ajax-response>\n");
} else if (format == FORMAT_HTML)
ast_build_string(&c, &len, "</table></body>\r\n");
}
ast_mutex_lock(&s->__lock);
if (s->needdestroy) {
if (s->inuse == 1) {