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