[master] e32a440 Synchronize harder with the VSL thread in vtc_varnish.c
Poul-Henning Kamp
phk at FreeBSD.org
Wed Mar 8 20:51:05 CET 2017
commit e32a44091d50ffa2c6894b6331753904c6d7ce4b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Mar 8 19:50:16 2017 +0000
Synchronize harder with the VSL thread in vtc_varnish.c
Some lowhanging Flexelint nitpicking.
diff --git a/bin/varnishtest/hpack.h b/bin/varnishtest/hpack.h
index feca984..9df6785 100644
--- a/bin/varnishtest/hpack.h
+++ b/bin/varnishtest/hpack.h
@@ -49,5 +49,7 @@ uint32_t HPK_GetTblSize(const struct hpk_ctx *ctx);
uint32_t HPK_GetTblMaxSize(const struct hpk_ctx *ctx);
uint32_t HPK_GetTblLength(const struct hpk_ctx *ctx);
+#if 0
/* DEBUG */
void dump_dyn_tbl(const struct hpk_ctx *ctx);
+#endif
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 4db8e78..0e09392 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -90,12 +90,9 @@ extern int leave_temp;
extern int vtc_witness;
extern int feature_dns;
-void init_barrier(void);
void init_server(void);
int http_process(struct vtclog *vl, const char *spec, int sock, int *sfd);
-int http2_process(struct vtclog *vl, const char *spec, int sock, int *sfd,
- unsigned nosettings);
char * synth_body(const char *len, int rnd);
diff --git a/bin/varnishtest/vtc_h2_tbl.c b/bin/varnishtest/vtc_h2_tbl.c
index 209fa47..cfb18b8 100644
--- a/bin/varnishtest/vtc_h2_tbl.c
+++ b/bin/varnishtest/vtc_h2_tbl.c
@@ -257,6 +257,7 @@ HPK_GetTblLength(const struct hpk_ctx *ctx)
return (l);
}
+#if 0
void
dump_dyn_tbl(const struct hpk_ctx *ctx)
{
@@ -269,6 +270,7 @@ dump_dyn_tbl(const struct hpk_ctx *ctx)
}
printf("DONE\n");
}
+#endif
struct hpk_ctx *
HPK_NewCtx(uint32_t maxsize)
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index c3432f2..26d478d 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -55,10 +55,6 @@
#include "vtcp.h"
#include "vtim.h"
-extern int leave_temp;
-extern char *vmod_path;
-extern struct vsb *params_vsb;
-
struct varnish {
unsigned magic;
#define VARNISH_MAGIC 0x208cd8e3
@@ -85,7 +81,7 @@ struct varnish {
unsigned vsl_tag_count[256];
- volatile int vsl_idle;
+ volatile int vsl_rec;
};
#define NONSENSE "%XJEIFLH|)Xspa8P"
@@ -209,9 +205,8 @@ varnishlog_thread(void *priv)
c = NULL;
opt = 0;
- while (v->pid) {
+ while (v->pid || c != NULL) {
if (c == NULL) {
- v->vsl_idle++;
VTIM_sleep(0.1);
if (VSM_Open(vsm)) {
VSM_ResetError(vsm);
@@ -232,12 +227,10 @@ varnishlog_thread(void *priv)
if (i != 1)
break;
- v->vsl_idle = 0;
+ v->vsl_rec = 1;
tag = VSL_TAG(c->rec.ptr);
vxid = VSL_ID(c->rec.ptr);
- if (tag != SLT_CLI)
- v->vsl_idle = 0;
if (tag == SLT__Batch)
continue;
tagname = VSL_tags[tag];
@@ -251,7 +244,6 @@ varnishlog_thread(void *priv)
vxid, tagname, type, (int)len, data);
}
if (i == 0) {
- v->vsl_idle++;
/* Nothing to do but wait */
VTIM_sleep(0.1);
} else if (i == -2) {
@@ -263,8 +255,6 @@ varnishlog_thread(void *priv)
break;
}
- v->vsl_idle = 100;
-
if (c)
VSL_DeleteCursor(c);
VSL_Delete(vsl);
@@ -568,7 +558,7 @@ varnish_start(struct varnish *v)
macro_def(v->vl, v->name, "port", "%s", p);
macro_def(v->vl, v->name, "sock", "%s %s", h, p);
/* Wait for vsl logging to get underway */
- while (v->vsl_idle == 0)
+ while (v->vsl_rec == 0)
VTIM_sleep(.1);
}
@@ -610,10 +600,6 @@ varnish_cleanup(struct varnish *v)
int status, r;
struct rusage ru;
- /* Give the VSL log time to finish */
- while (v->vsl_idle < 10)
- (void)usleep(200000);
-
/* Close the CLI connection */
closefd(&v->cli_fd);
More information about the varnish-commit
mailing list