Issue #6884 - manager.c formatting (casper)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2006-04-04 19:03:12 +00:00
parent 42fddfa075
commit f8f83ff9b8

104
manager.c
View File

@@ -176,14 +176,15 @@ int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
{ {
/* Try to write string, but wait no more than ms milliseconds /* Try to write string, but wait no more than ms milliseconds
before timing out */ before timing out */
int res=0; int res = 0;
struct pollfd fds[1]; struct pollfd fds[1];
while(len) { while (len) {
res = write(fd, s, len); res = write(fd, s, len);
if ((res < 0) && (errno != EAGAIN)) { if ((res < 0) && (errno != EAGAIN)) {
return -1; return -1;
} }
if (res < 0) res = 0; if (res < 0)
res = 0;
len -= res; len -= res;
s += res; s += res;
res = 0; res = 0;
@@ -240,7 +241,7 @@ static char *complete_show_mancmd(const char *line, const char *word, int pos, i
static void xml_copy_escape(char **dst, size_t *maxlen, const char *src, int lower) static void xml_copy_escape(char **dst, size_t *maxlen, const char *src, int lower)
{ {
while (*src && (*maxlen > 6)) { while (*src && (*maxlen > 6)) {
switch(*src) { switch (*src) {
case '<': case '<':
strcpy(*dst, "&lt;"); strcpy(*dst, "&lt;");
(*dst) += 4; (*dst) += 4;
@@ -277,9 +278,9 @@ static void xml_copy_escape(char **dst, size_t *maxlen, const char *src, int low
static char *xml_translate(char *in, struct ast_variable *vars) static char *xml_translate(char *in, struct ast_variable *vars)
{ {
struct ast_variable *v; struct ast_variable *v;
char *dest=NULL; char *dest = NULL;
char *out, *tmp, *var, *val; char *out, *tmp, *var, *val;
char *objtype=NULL; char *objtype = NULL;
int colons = 0; int colons = 0;
int breaks = 0; int breaks = 0;
size_t len; size_t len;
@@ -289,7 +290,7 @@ static char *xml_translate(char *in, struct ast_variable *vars)
int x; int x;
v = vars; v = vars;
while(v) { while (v) {
if (!dest && !strcasecmp(v->name, "ajaxdest")) if (!dest && !strcasecmp(v->name, "ajaxdest"))
dest = v->value; dest = v->value;
else if (!objtype && !strcasecmp(v->name, "ajaxobjtype")) else if (!objtype && !strcasecmp(v->name, "ajaxobjtype"))
@@ -313,7 +314,7 @@ static char *xml_translate(char *in, struct ast_variable *vars)
if (!out) if (!out)
return 0; return 0;
tmp = out; tmp = out;
while(*in) { while (*in) {
var = in; var = in;
while (*in && (*in >= 32)) while (*in && (*in >= 32))
in++; in++;
@@ -357,7 +358,7 @@ static char *html_translate(char *in)
int colons = 0; int colons = 0;
int breaks = 0; int breaks = 0;
size_t len; size_t len;
int count=1; int count = 1;
char *tmp, *var, *val, *out; char *tmp, *var, *val, *out;
for (x=0; in[x]; x++) { for (x=0; in[x]; x++) {
@@ -371,7 +372,7 @@ static char *html_translate(char *in)
if (!out) if (!out)
return 0; return 0;
tmp = out; tmp = out;
while(*in) { while (*in) {
var = in; var = in;
while (*in && (*in >= 32)) while (*in && (*in >= 32))
in++; in++;
@@ -560,7 +561,7 @@ static void free_session(struct mansession *s)
if (s->outputstr) if (s->outputstr)
free(s->outputstr); free(s->outputstr);
ast_mutex_destroy(&s->__lock); ast_mutex_destroy(&s->__lock);
while(s->eventq) { while (s->eventq) {
eqe = s->eventq; eqe = s->eventq;
s->eventq = s->eventq->next; s->eventq = s->eventq->next;
unuse_eventqent(eqe); unuse_eventqent(eqe);
@@ -573,7 +574,7 @@ static void destroy_session(struct mansession *s)
struct mansession *cur, *prev = NULL; struct mansession *cur, *prev = NULL;
ast_mutex_lock(&sessionlock); ast_mutex_lock(&sessionlock);
cur = sessions; cur = sessions;
while(cur) { while (cur) {
if (cur == s) if (cur == s)
break; break;
prev = cur; prev = cur;
@@ -589,7 +590,6 @@ static void destroy_session(struct mansession *s)
} else } else
ast_log(LOG_WARNING, "Trying to delete nonexistent session %p?\n", s); ast_log(LOG_WARNING, "Trying to delete nonexistent session %p?\n", s);
ast_mutex_unlock(&sessionlock); ast_mutex_unlock(&sessionlock);
} }
char *astman_get_header(struct message *m, char *var) char *astman_get_header(struct message *m, char *var)
@@ -597,7 +597,7 @@ char *astman_get_header(struct message *m, char *var)
char cmp[80]; char cmp[80];
int x; int x;
snprintf(cmp, sizeof(cmp), "%s: ", var); snprintf(cmp, sizeof(cmp), "%s: ", var);
for (x=0;x<m->hdrcount;x++) for (x=0; x<m->hdrcount; x++)
if (!strncasecmp(cmp, m->headers[x], strlen(cmp))) if (!strncasecmp(cmp, m->headers[x], strlen(cmp)))
return m->headers[x] + strlen(cmp); return m->headers[x] + strlen(cmp);
return ""; return "";
@@ -659,7 +659,7 @@ void astman_send_error(struct mansession *s, struct message *m, char *error)
astman_append(s, "Response: Error\r\n"); astman_append(s, "Response: Error\r\n");
if (!ast_strlen_zero(id)) if (!ast_strlen_zero(id))
astman_append(s, "ActionID: %s\r\n",id); astman_append(s, "ActionID: %s\r\n", id);
astman_append(s, "Message: %s\r\n\r\n", error); astman_append(s, "Message: %s\r\n\r\n", error);
} }
@@ -669,7 +669,7 @@ void astman_send_response(struct mansession *s, struct message *m, char *resp, c
astman_append(s, "Response: %s\r\n", resp); astman_append(s, "Response: %s\r\n", resp);
if (!ast_strlen_zero(id)) if (!ast_strlen_zero(id))
astman_append(s, "ActionID: %s\r\n",id); astman_append(s, "ActionID: %s\r\n", id);
if (msg) if (msg)
astman_append(s, "Message: %s\r\n\r\n", msg); astman_append(s, "Message: %s\r\n\r\n", msg);
else else
@@ -794,7 +794,7 @@ static int authenticate(struct mansession *s, struct message *m)
if (!cfg) if (!cfg)
return -1; return -1;
cat = ast_category_browse(cfg, NULL); cat = ast_category_browse(cfg, NULL);
while(cat) { while (cat) {
if (strcasecmp(cat, "general")) { if (strcasecmp(cat, "general")) {
/* This is a user */ /* This is a user */
if (!strcasecmp(cat, user)) { if (!strcasecmp(cat, user)) {
@@ -829,7 +829,7 @@ static int authenticate(struct mansession *s, struct message *m)
if (!strcasecmp(authtype, "MD5")) { if (!strcasecmp(authtype, "MD5")) {
if (!ast_strlen_zero(key) && s->challenge) { if (!ast_strlen_zero(key) && s->challenge) {
int x; int x;
int len=0; int len = 0;
char md5key[256] = ""; char md5key[256] = "";
struct MD5Context md5; struct MD5Context md5;
unsigned char digest[16]; unsigned char digest[16];
@@ -837,7 +837,7 @@ static int authenticate(struct mansession *s, struct message *m)
MD5Update(&md5, (unsigned char *) s->challenge, strlen(s->challenge)); MD5Update(&md5, (unsigned char *) s->challenge, strlen(s->challenge));
MD5Update(&md5, (unsigned char *) password, strlen(password)); MD5Update(&md5, (unsigned char *) password, strlen(password));
MD5Final(digest, &md5); MD5Final(digest, &md5);
for (x=0;x<16;x++) for (x=0; x<16; x++)
len += sprintf(md5key + len, "%2.2x", digest[x]); len += sprintf(md5key + len, "%2.2x", digest[x]);
if (!strcmp(md5key, key)) if (!strcmp(md5key, key))
break; break;
@@ -900,7 +900,7 @@ static int action_waitevent(struct mansession *s, struct message *m)
time_t now; time_t now;
struct eventqent *eqe; struct eventqent *eqe;
char *id = astman_get_header(m,"ActionID"); char *id = astman_get_header(m,"ActionID");
char idText[256]=""; char idText[256] = "";
if (!ast_strlen_zero(id)) if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id); snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -930,7 +930,7 @@ static int action_waitevent(struct mansession *s, struct message *m)
s->waiting_thread = pthread_self(); s->waiting_thread = pthread_self();
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "Starting waiting for an event!\n"); ast_log(LOG_DEBUG, "Starting waiting for an event!\n");
for (x=0;((x<timeout) || (timeout < 0)); x++) { for (x=0; ((x < timeout) || (timeout < 0)); x++) {
ast_mutex_lock(&s->__lock); ast_mutex_lock(&s->__lock);
if (s->eventq && s->eventq->next) if (s->eventq && s->eventq->next)
needexit = 1; needexit = 1;
@@ -966,7 +966,7 @@ static int action_waitevent(struct mansession *s, struct message *m)
astman_append(s, astman_append(s,
"Event: WaitEventComplete\r\n" "Event: WaitEventComplete\r\n"
"%s" "%s"
"\r\n",idText); "\r\n", idText);
s->waiting_thread = AST_PTHREADT_NULL; s->waiting_thread = AST_PTHREADT_NULL;
} else { } else {
ast_log(LOG_DEBUG, "Abandoning event request!\n"); ast_log(LOG_DEBUG, "Abandoning event request!\n");
@@ -993,7 +993,7 @@ static int action_listcommands(struct mansession *s, struct message *m)
ast_mutex_lock(&actionlock); ast_mutex_lock(&actionlock);
while (cur) { /* Walk the list of actions */ while (cur) { /* Walk the list of actions */
if ((s->writeperm & cur->authority) == cur->authority) if ((s->writeperm & cur->authority) == cur->authority)
astman_append(s, "%s: %s (Priv: %s)\r\n", cur->action, cur->synopsis, authority_to_str(cur->authority, temp, sizeof(temp)) ); astman_append(s, "%s: %s (Priv: %s)\r\n", cur->action, cur->synopsis, authority_to_str(cur->authority, temp, sizeof(temp)));
cur = cur->next; cur = cur->next;
} }
ast_mutex_unlock(&actionlock); ast_mutex_unlock(&actionlock);
@@ -1157,7 +1157,7 @@ static int action_status(struct mansession *s, struct message *m)
struct ast_channel *c; struct ast_channel *c;
char bridge[256]; char bridge[256];
struct timeval now = ast_tvnow(); struct timeval now = ast_tvnow();
long elapsed_seconds=0; long elapsed_seconds = 0;
int all = ast_strlen_zero(name); /* set if we want all channels */ int all = ast_strlen_zero(name); /* set if we want all channels */
astman_send_ack(s, m, "Channel status will follow"); astman_send_ack(s, m, "Channel status will follow");
@@ -1173,7 +1173,7 @@ static int action_status(struct mansession *s, struct message *m)
} }
} }
/* if we look by name, we break after the first iteration */ /* if we look by name, we break after the first iteration */
while(c) { while (c) {
if (c->_bridge) if (c->_bridge)
snprintf(bridge, sizeof(bridge), "Link: %s\r\n", c->_bridge->name); snprintf(bridge, sizeof(bridge), "Link: %s\r\n", c->_bridge->name);
else else
@@ -1393,7 +1393,7 @@ static int action_originate(struct mansession *s, struct message *m)
char *id = astman_get_header(m, "ActionID"); char *id = astman_get_header(m, "ActionID");
struct ast_variable *vars = astman_get_variables(m); struct ast_variable *vars = astman_get_variables(m);
char *tech, *data; char *tech, *data;
char *l=NULL, *n=NULL; char *l = NULL, *n = NULL;
int pi = 0; int pi = 0;
int res; int res;
int to = 30000; int to = 30000;
@@ -1666,7 +1666,7 @@ static int process_message(struct mansession *s, struct message *m)
return 0; return 0;
} }
if (!ast_strlen_zero(id)) { if (!ast_strlen_zero(id)) {
snprintf(idText, sizeof(idText), "ActionID: %s\r\n",id); snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
} }
if (!s->authenticated) { if (!s->authenticated) {
if (!strcasecmp(action, "Challenge")) { if (!strcasecmp(action, "Challenge")) {
@@ -1679,7 +1679,7 @@ static int process_message(struct mansession *s, struct message *m)
astman_append(s, "Response: Success\r\n" astman_append(s, "Response: Success\r\n"
"%s" "%s"
"Challenge: %s\r\n\r\n", "Challenge: %s\r\n\r\n",
idText,s->challenge); idText, s->challenge);
ast_mutex_unlock(&s->__lock); ast_mutex_unlock(&s->__lock);
return 0; return 0;
} else { } else {
@@ -1694,7 +1694,7 @@ static int process_message(struct mansession *s, struct message *m)
} else { } else {
s->authenticated = 1; s->authenticated = 1;
if (option_verbose > 1) { if (option_verbose > 1) {
if ( displayconnects ) { if (displayconnects) {
ast_verbose(VERBOSE_PREFIX_2 "%sManager '%s' logged on from %s\n", (s->sessiontimeout ? "HTTP " : ""), s->username, ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); ast_verbose(VERBOSE_PREFIX_2 "%sManager '%s' logged on from %s\n", (s->sessiontimeout ? "HTTP " : ""), s->username, ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr));
} }
} }
@@ -1710,7 +1710,7 @@ static int process_message(struct mansession *s, struct message *m)
ast_mutex_lock(&s->__lock); ast_mutex_lock(&s->__lock);
s->busy++; s->busy++;
ast_mutex_unlock(&s->__lock); ast_mutex_unlock(&s->__lock);
while( tmp ) { while (tmp) {
if (!strcasecmp(action, tmp->action)) { if (!strcasecmp(action, tmp->action)) {
if ((s->writeperm & tmp->authority) == tmp->authority) { if ((s->writeperm & tmp->authority) == tmp->authority) {
if (tmp->func(s, m)) if (tmp->func(s, m))
@@ -1737,7 +1737,7 @@ static int get_input(struct mansession *s, char *output)
int x; int x;
struct pollfd fds[1]; struct pollfd fds[1];
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
for (x=1;x<s->inlen;x++) { for (x = 1; x < s->inlen; x++) {
if ((s->inbuf[x] == '\n') && (s->inbuf[x-1] == '\r')) { if ((s->inbuf[x] == '\n') && (s->inbuf[x-1] == '\r')) {
/* Copy output data up to and including \r\n */ /* Copy output data up to and including \r\n */
memcpy(output, s->inbuf, x + 1); memcpy(output, s->inbuf, x + 1);
@@ -1821,12 +1821,12 @@ static void *session_do(void *data)
if (s->authenticated) { if (s->authenticated) {
if (option_verbose > 1) { if (option_verbose > 1) {
if (displayconnects) if (displayconnects)
ast_verbose(VERBOSE_PREFIX_2 "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); ast_verbose(VERBOSE_PREFIX_2 "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr));
} }
ast_log(LOG_EVENT, "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); ast_log(LOG_EVENT, "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr));
} else { } else {
if (option_verbose > 1) { if (option_verbose > 1) {
if ( displayconnects ) if (displayconnects)
ast_verbose(VERBOSE_PREFIX_2 "Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); ast_verbose(VERBOSE_PREFIX_2 "Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr));
} }
ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr));
@@ -1841,7 +1841,7 @@ static void *accept_thread(void *ignore)
struct sockaddr_in sin; struct sockaddr_in sin;
socklen_t sinlen; socklen_t sinlen;
struct eventqent *eqe; struct eventqent *eqe;
struct mansession *s, *prev=NULL, *next; struct mansession *s, *prev = NULL, *next;
struct protoent *p; struct protoent *p;
int arg = 1; int arg = 1;
int flags; int flags;
@@ -1858,7 +1858,7 @@ static void *accept_thread(void *ignore)
ast_mutex_lock(&sessionlock); ast_mutex_lock(&sessionlock);
prev = NULL; prev = NULL;
s = sessions; s = sessions;
while(s) { while (s) {
next = s->next; next = s->next;
if (s->sessiontimeout && (now > s->sessiontimeout) && !s->inuse) { if (s->sessiontimeout && (now > s->sessiontimeout) && !s->inuse) {
num_sessions--; num_sessions--;
@@ -1913,7 +1913,7 @@ static void *accept_thread(void *ignore)
s->writetimeout = 100; s->writetimeout = 100;
s->waiting_thread = AST_PTHREADT_NULL; s->waiting_thread = AST_PTHREADT_NULL;
if(! block_sockets) { if (!block_sockets) {
/* For safety, make sure socket is non-blocking */ /* For safety, make sure socket is non-blocking */
flags = fcntl(as, F_GETFL); flags = fcntl(as, F_GETFL);
fcntl(as, F_SETFL, flags | O_NONBLOCK); fcntl(as, F_SETFL, flags | O_NONBLOCK);
@@ -1943,7 +1943,7 @@ static void *accept_thread(void *ignore)
static int append_event(const char *str, int category) static int append_event(const char *str, int category)
{ {
struct eventqent *tmp, *prev=NULL; struct eventqent *tmp, *prev = NULL;
tmp = malloc(sizeof(struct eventqent) + strlen(str)); tmp = malloc(sizeof(struct eventqent) + strlen(str));
if (tmp) { if (tmp) {
ast_mutex_init(&tmp->lock); ast_mutex_init(&tmp->lock);
@@ -1952,7 +1952,7 @@ static int append_event(const char *str, int category)
strcpy(tmp->eventdata, str); strcpy(tmp->eventdata, str);
if (master_eventq) { if (master_eventq) {
prev = master_eventq; prev = master_eventq;
while(prev->next) while (prev->next)
prev = prev->next; prev = prev->next;
prev->next = tmp; prev->next = tmp;
} else { } else {
@@ -2012,7 +2012,7 @@ int ast_manager_unregister( char *action )
struct manager_action *cur = first_action, *prev = first_action; struct manager_action *cur = first_action, *prev = first_action;
ast_mutex_lock(&actionlock); ast_mutex_lock(&actionlock);
while( cur ) { while (cur) {
if (!strcasecmp(action, cur->action)) { if (!strcasecmp(action, cur->action)) {
prev->next = cur->next; prev->next = cur->next;
free(cur); free(cur);
@@ -2041,7 +2041,7 @@ static int ast_manager_register_struct(struct manager_action *act)
int ret; int ret;
ast_mutex_lock(&actionlock); ast_mutex_lock(&actionlock);
while(cur) { /* Walk the list of actions */ while (cur) { /* Walk the list of actions */
ret = strcasecmp(cur->action, act->action); ret = strcasecmp(cur->action, act->action);
if (ret == 0) { if (ret == 0) {
ast_log(LOG_WARNING, "Manager: Action '%s' already registered\n", act->action); ast_log(LOG_WARNING, "Manager: Action '%s' already registered\n", act->action);
@@ -2106,7 +2106,7 @@ static struct mansession *find_session(unsigned long ident)
struct mansession *s; struct mansession *s;
ast_mutex_lock(&sessionlock); ast_mutex_lock(&sessionlock);
s = sessions; s = sessions;
while(s) { while (s) {
ast_mutex_lock(&s->__lock); ast_mutex_lock(&s->__lock);
if (s->sessiontimeout && (s->managerid == ident) && !s->needdestroy) { if (s->sessiontimeout && (s->managerid == ident) && !s->needdestroy) {
s->inuse++; s->inuse++;
@@ -2123,7 +2123,7 @@ static struct mansession *find_session(unsigned long ident)
static void vars2msg(struct message *m, struct ast_variable *vars) static void vars2msg(struct message *m, struct ast_variable *vars)
{ {
int x; int x;
for (x=0;vars && (x<AST_MAX_MANHEADERS);x++,vars = vars->next) { for (x = 0; vars && (x < AST_MAX_MANHEADERS); x++, vars = vars->next) {
if (!vars) if (!vars)
break; break;
m->hdrcount = x + 1; m->hdrcount = x + 1;
@@ -2139,20 +2139,20 @@ static char *contenttype[] = { "plain", "html", "xml" };
static char *generic_http_callback(int format, struct sockaddr_in *requestor, const char *uri, struct ast_variable *params, int *status, char **title, int *contentlength) static char *generic_http_callback(int format, struct sockaddr_in *requestor, const char *uri, struct ast_variable *params, int *status, char **title, int *contentlength)
{ {
struct mansession *s=NULL; struct mansession *s = NULL;
unsigned long ident=0; unsigned long ident = 0;
char workspace[256]; char workspace[256];
char cookie[128]; char cookie[128];
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
size_t len = sizeof(workspace); size_t len = sizeof(workspace);
int blastaway = 0; int blastaway = 0;
char *c = workspace; char *c = workspace;
char *retval=NULL; char *retval = NULL;
struct message m; struct message m;
struct ast_variable *v; struct ast_variable *v;
v = params; v = params;
while(v) { while (v) {
if (!strcasecmp(v->name, "mansession_id")) { if (!strcasecmp(v->name, "mansession_id")) {
sscanf(v->value, "%lx", &ident); sscanf(v->value, "%lx", &ident);
break; break;
@@ -2178,7 +2178,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co
num_sessions++; num_sessions++;
/* Hook into the last spot in the event queue */ /* Hook into the last spot in the event queue */
s->eventq = master_eventq; s->eventq = master_eventq;
while(s->eventq->next) while (s->eventq->next)
s->eventq = s->eventq->next; s->eventq = s->eventq->next;
ast_mutex_lock(&s->eventq->lock); ast_mutex_lock(&s->eventq->lock);
s->eventq->usecount++; s->eventq->usecount++;
@@ -2326,7 +2326,7 @@ int init_manager(void)
static struct sockaddr_in ba; static struct sockaddr_in ba;
int x = 1; int x = 1;
int flags; int flags;
int webenabled=0; int webenabled = 0;
int newhttptimeout = 60; int newhttptimeout = 60;
if (!registered) { if (!registered) {
/* Register default actions */ /* Register default actions */
@@ -2368,7 +2368,7 @@ int init_manager(void)
enabled = ast_true(val); enabled = ast_true(val);
val = ast_variable_retrieve(cfg, "general", "block-sockets"); val = ast_variable_retrieve(cfg, "general", "block-sockets");
if(val) if (val)
block_sockets = ast_true(val); block_sockets = ast_true(val);
val = ast_variable_retrieve(cfg, "general", "webenabled"); val = ast_variable_retrieve(cfg, "general", "webenabled");
@@ -2402,6 +2402,7 @@ int init_manager(void)
} }
} }
if ((asock > -1) && ((portno != oldportno) || !enabled)) { if ((asock > -1) && ((portno != oldportno) || !enabled)) {
#if 0 #if 0
/* Can't be done yet */ /* Can't be done yet */
@@ -2431,11 +2432,12 @@ int init_manager(void)
if (newhttptimeout > 0) if (newhttptimeout > 0)
httptimeout = newhttptimeout; httptimeout = newhttptimeout;
/* If not enabled, do nothing */ /* If not enabled, do nothing */
if (!enabled) { if (!enabled) {
return 0; return 0;
} }
if (asock < 0) { if (asock < 0) {
asock = socket(AF_INET, SOCK_STREAM, 0); asock = socket(AF_INET, SOCK_STREAM, 0);
if (asock < 0) { if (asock < 0) {