From: phk Date: Tue, 11 Jul 2006 21:35:31 +0000 (+0000) Subject: EOF detection in libevent is buggy ?? Add exit cmd. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c95a72d758b0fa35aef214f9f300c7a20746b594;p=varnish 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 --- 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);