Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
f6e05865
Commit
f6e05865
authored
Apr 29, 2013
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make varnishtest work again with new VSL api
parent
607b7af7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
29 deletions
+62
-29
Makefile.am
bin/Makefile.am
+1
-1
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+61
-28
No files found.
bin/Makefile.am
View file @
f6e05865
...
...
@@ -3,7 +3,7 @@
# Disabling building of the tools while api is in flux
#SUBDIRS = varnishadm varnishd varnishlog varnishncsa varnishreplay varnishtest
SUBDIRS
=
varnishadm varnishd varnishlog
SUBDIRS
=
varnishadm varnishd varnishlog
varnishtest
if
HAVE_CURSES
#SUBDIRS += varnishhist varnishstat varnishtop
...
...
bin/varnishtest/vtc_varnish.c
View file @
f6e05865
...
...
@@ -48,6 +48,7 @@
#include "vcli.h"
#include "vss.h"
#include "vtcp.h"
#include "vtim.h"
struct
varnish
{
unsigned
magic
;
...
...
@@ -172,44 +173,76 @@ wait_running(const struct varnish *v)
}
/**********************************************************************
* Varnishlog gatherer
+
thread
* Varnishlog gatherer thread
*/
static
int
h_addlog
(
void
*
priv
,
enum
VSL_tag_e
tag
,
unsigned
fd
,
unsigned
len
,
unsigned
spec
,
const
char
*
ptr
,
uint64_t
bitmap
)
static
void
*
varnishlog_thread
(
void
*
priv
)
{
struct
varnish
*
v
;
int
type
;
struct
VSL_data
*
vsl
;
struct
VSM_data
*
vsm
;
struct
VSL_cursor
*
c
;
enum
VSL_tag_e
tag
;
uint32_t
vxid
;
unsigned
len
;
const
char
*
data
;
int
type
,
i
;
(
void
)
bitmap
;
type
=
(
spec
&
VSL_S_CLIENT
)
?
'c'
:
(
spec
&
VSL_S_BACKEND
)
?
'b'
:
'-'
;
CAST_OBJ_NOTNULL
(
v
,
priv
,
VARNISH_MAGIC
);
v
->
vsl_tag_count
[
tag
]
++
;
vsl
=
VSL_New
();
AN
(
vsl
);
vsm
=
VSM_New
();
AN
(
vsm
);
(
void
)
VSM_n_Arg
(
vsm
,
v
->
workdir
);
vtc_log
(
v
->
vl
,
4
,
"vsl| %5u %-12s %c %.*s"
,
fd
,
VSL_tags
[
tag
],
type
,
len
,
ptr
);
v
->
vsl_sleep
=
100
;
return
(
0
);
}
c
=
NULL
;
while
(
v
->
pid
)
{
if
(
c
==
NULL
)
{
VTIM_sleep
(
0
.
1
);
if
(
VSM_Open
(
vsm
))
{
VSM_ResetError
(
vsm
);
continue
;
}
c
=
VSL_CursorVSM
(
vsl
,
vsm
,
1
);
if
(
c
==
NULL
)
{
VSL_ResetError
(
vsl
);
continue
;
}
}
AN
(
c
);
static
void
*
varnishlog_thread
(
void
*
priv
)
{
struct
varnish
*
v
;
struct
VSM_data
*
vsl
;
i
=
VSL_Next
(
c
);
if
(
i
==
0
)
{
/* Nothing to do but wait */
VTIM_sleep
(
0
.
01
);
continue
;
}
else
if
(
i
==
-
2
)
{
/* Abandoned - try reconnect */
VSL_DeleteCursor
(
c
);
c
=
NULL
;
VSM_Close
(
vsm
);
continue
;
}
else
if
(
i
!=
1
)
break
;
CAST_OBJ_NOTNULL
(
v
,
priv
,
VARNISH_MAGIC
);
vsl
=
VSM_New
();
(
void
)
VSL_Arg
(
vsl
,
'n'
,
v
->
workdir
);
while
(
v
->
pid
)
{
if
(
VSL_Dispatch
(
vsl
,
h_addlog
,
v
)
<=
0
)
usleep
(
100000
);
tag
=
VSL_TAG
(
c
->
ptr
);
vxid
=
VSL_ID
(
c
->
ptr
);
len
=
VSL_LEN
(
c
->
ptr
);
type
=
VSL_CLIENT
(
c
->
ptr
)
?
'c'
:
VSL_BACKEND
(
c
->
ptr
)
?
'b'
:
'-'
;
data
=
VSL_CDATA
(
c
->
ptr
);
v
->
vsl_tag_count
[
tag
]
++
;
vtc_log
(
v
->
vl
,
4
,
"vsl| %10u %-15s %c %.*s"
,
vxid
,
VSL_tags
[
tag
],
type
,
(
int
)
len
,
data
);
}
VSM_Delete
(
vsl
);
if
(
c
)
VSL_DeleteCursor
(
c
);
VSL_Delete
(
vsl
);
VSM_Delete
(
vsm
);
return
(
NULL
);
}
...
...
@@ -449,7 +482,7 @@ varnish_launch(struct varnish *v)
vtc_log
(
v
->
vl
,
0
,
"CLI auth command failed: %u %s"
,
u
,
r
);
free
(
r
);
(
void
)
VS
L_Arg
(
v
->
vd
,
'n'
,
v
->
workdir
);
(
void
)
VS
M_n_Arg
(
v
->
vd
,
v
->
workdir
);
AZ
(
VSM_Open
(
v
->
vd
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment