Commit ccf0939d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Minor bit of cleanup: initialize CLI from main() instead of mgt_run().



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3861 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 278771e7
......@@ -37,11 +37,12 @@
struct cli;
extern struct vev_base *mgt_evb;
extern unsigned d_flag;
extern unsigned d_flag;
extern pid_t mgt_pid;
/* mgt_child.c */
void mgt_run(const char *T_arg);
extern pid_t mgt_pid, child_pid;
extern pid_t child_pid;
void MGT_Run(void);
void mgt_stop_child(void);
/* mgt_cli.c */
......
......@@ -64,7 +64,6 @@
#include "vss.h"
#include "vbm.h"
pid_t mgt_pid;
pid_t child_pid = -1;
static struct vbitmap *fd_map;
......@@ -89,7 +88,6 @@ static const char * const ch_state[] = {
[CH_DIED] = "died, (restarting)",
};
struct vev_base *mgt_evb;
static struct vev *ev_poker;
static struct vev *ev_listen;
static struct vlu *vlu;
......@@ -499,23 +497,12 @@ mgt_sigint(const struct vev *e, int what)
*/
void
mgt_run(const char *T_arg)
MGT_Run(void)
{
struct sigaction sac;
struct vev *e;
int i;
mgt_pid = getpid();
mgt_evb = vev_new_base();
XXXAN(mgt_evb);
if (d_flag)
mgt_cli_setup(0, 1, 1, "debug");
if (T_arg)
mgt_cli_telnet(T_arg);
e = vev_new();
XXXAN(e);
e->sig = SIGTERM;
......
......@@ -58,6 +58,7 @@
#endif
#include "vsb.h"
#include "vev.h"
#include "vpf.h"
#include "vsha256.h"
......@@ -76,9 +77,13 @@
#define INFTIM -1
#endif
struct heritage heritage;
volatile struct params *params;
unsigned d_flag = 0;
struct heritage heritage;
volatile struct params *params;
unsigned d_flag = 0;
pid_t mgt_pid;
struct vev_base *mgt_evb;
/*--------------------------------------------------------------------*/
......@@ -605,7 +610,17 @@ main(int argc, char * const *argv)
if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
mgt_run(T_arg);
mgt_pid = getpid();
mgt_evb = vev_new_base();
XXXAN(mgt_evb);
if (d_flag)
mgt_cli_setup(0, 1, 1, "debug");
if (T_arg)
mgt_cli_telnet(T_arg);
MGT_Run();
if (pfh != NULL)
(void)vpf_remove(pfh);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment