From c95a72d758b0fa35aef214f9f300c7a20746b594 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 11 Jul 2006 21:35:31 +0000 Subject: [PATCH] EOF detection in libevent is buggy ?? Add exit cmd. Pause after cli until we see "OK" git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@447 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishtester/varnishtester.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/varnish-cache/bin/varnishtester/varnishtester.c b/varnish-cache/bin/varnishtester/varnishtester.c index bdab6821..78b5fe51 100644 --- a/varnish-cache/bin/varnishtester/varnishtester.c +++ b/varnish-cache/bin/varnishtester/varnishtester.c @@ -218,6 +218,8 @@ rd_pipe2(struct bufferevent *bev, void *arg) printf("V: <<%s>>\n", p); if (!strcmp(p, "Child said ")) Resume(); + else if (!strcmp(p, "OK")) + Resume(); } } @@ -305,6 +307,7 @@ cmd_cli(char **av) } cli_write(av[0]); cli_write("\n"); + Pause(); } /*--------------------------------------------------------------------*/ @@ -461,6 +464,18 @@ cmd_req(char **av) /*--------------------------------------------------------------------*/ +static void +cmd_exit(char **av) +{ + + (void)av; + cmd_close(NULL); + cmd_stop(NULL); + exit (0); +} + +/*--------------------------------------------------------------------*/ + static struct bufferevent *e_cmd; static int run = 1; @@ -500,6 +515,8 @@ rd_cmd(struct bufferevent *bev, void *arg) cmd_close(av + 2); else if (!strcmp(av[1], "req")) cmd_req(av + 2); + else if (!strcmp(av[1], "exit")) + cmd_exit(av + 2); else { fprintf(stderr, "Unknown command \"%s\"\n", av[1]); exit (2); -- 2.39.5