Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent
Commits
ac15e0ce
Commit
ac15e0ce
authored
Mar 30, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement DATA_Dump() (no test yet)
parent
a622325e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
31 deletions
+49
-31
data.c
src/data.c
+46
-28
varnishevent.h
src/varnishevent.h
+3
-3
No files found.
src/data.c
View file @
ac15e0ce
...
...
@@ -56,9 +56,7 @@
#define FAKE_DEFAULT_LINES_PER_TX 10
#if 0
static const char *statename[3] = { "EMPTY", "OPEN", "DONE" };
#endif
static
const
char
*
statename
[
3
]
=
{
"EMPTY"
,
"DONE"
};
static
pthread_mutex_t
freetx_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
freeline_lock
=
PTHREAD_MUTEX_INITIALIZER
;
...
...
@@ -241,48 +239,68 @@ DATA_Return_Free(chunk)
void
DATA_Dump
(
void
)
{
#if 0
struct
vsb
*
data
;
logline_t *ll;
if
(
txn
==
NULL
)
return
;
data
=
VSB_new_auto
();
for
(
int
i
=
0
;
i
<
config
.
max_data
;
i
++
)
{
int j;
tx_t
*
tx
;
logline_t
*
rec
;
if (logline == NULL || logline[i].magic != LOGLINE_MAGIC)
if
(
txn
[
i
].
magic
!=
TX_MAGIC
)
{
LOG_Log
(
LOG_ALERT
,
"Invalid tx at index %d, magic = 0x%08x, expected 0x%08x"
,
i
,
txn
[
i
].
magic
,
TX_MAGIC
);
continue
;
}
if (
logline[i].state == DATA
_EMPTY)
if
(
txn
[
i
].
state
==
TX
_EMPTY
)
continue
;
ll = &logline
[i];
tx
=
&
txn
[
i
];
VSB_clear
(
data
);
VSB_printf(data, "Data entry %d: state=%s dir=%c tags={",
i, statename[ll->state],
C(ll->spec) ? 'c' : B(ll->spec) ? 'b' : '-');
for (j = 0; j < ntags; j++)
if (ll->tag[j].len) {
VSB_cat(data, VSL_tags[idx2tag[j]]);
VSB_cat(data, "=[");
VSB_bcat(data, ll->tag[j].data, ll->tag[j].len);
VSB_cat(data, "] ");
VSB_printf
(
data
,
"Tx entry %d: vxid=%u state=%s dir=%c records={"
,
i
,
tx
->
vxid
,
statename
[
tx
->
state
],
C
(
tx
->
type
)
?
'c'
:
B
(
tx
->
type
)
?
'b'
:
'-'
);
VSTAILQ_FOREACH
(
rec
,
&
tx
->
lines
,
linelist
)
{
if
(
rec
==
NULL
)
continue
;
if
(
rec
->
magic
!=
LOGLINE_MAGIC
)
{
LOG_Log
(
LOG_ALERT
,
"Invalid record at tx %d, magic = 0x%08x, expected 0x%08x"
,
i
,
rec
->
magic
,
LOGLINE_MAGIC
);
continue
;
}
VSB_printf
(
data
,
"%s "
,
VSL_tags
[
rec
->
tag
]);
if
(
rec
->
len
)
{
int
n
=
rec
->
len
;
chunk_t
*
chunk
=
VSTAILQ_FIRST
(
&
rec
->
chunks
);
while
(
n
>
0
&&
chunk
!=
NULL
)
{
if
(
chunk
->
magic
!=
CHUNK_MAGIC
)
{
LOG_Log
(
LOG_ALERT
,
"Invalid chunk at tx %d, magic = 0x%08x, "
"expected 0x%08x"
,
i
,
chunk
->
magic
,
CHUNK_MAGIC
);
continue
;
}
int
cp
=
n
;
if
(
cp
>
config
.
chunk_size
)
cp
=
config
.
chunk_size
;
VSB_bcat
(
data
,
chunk
->
data
,
cp
);
n
-=
cp
;
chunk
=
VSTAILQ_NEXT
(
chunk
,
chunklist
);
}
}
}
VSB_cat(data, "} rx_headers={");
DUMP_HDRS(data, ll, rx_headers);
VSB_cat(data, "} tx_headers={");
DUMP_HDRS(data, ll, tx_headers);
VSB_cat(data, "} vcl_log={");
DUMP_HDRS(data, ll, vcl_log);
VSB_putc
(
data
,
'}'
);
VSB_finish
(
data
);
LOG_Log
(
LOG_INFO
,
"%s"
,
VSB_data
(
data
));
}
#endif
}
src/varnishevent.h
View file @
ac15e0ce
...
...
@@ -41,9 +41,9 @@
#include "vqueue.h"
#include "vsb.h"
#define C(
spec) ((spec) & VSL_S_CLIENT
)
#define B(
spec) ((spec) & VSL_S_BACKEND
)
#define Z(
spec) ((spec) == 0
)
#define C(
txtype) ((txtype) == VSL_t_req
)
#define B(
txtype) ((txtype) == VSL_t_bereq
)
#define Z(
txtype) ((txtype) == VSL_t_raw
)
/* Defaults from Varnish 3.0.3 */
#define DEFAULT_MAX_RECLEN 255
/* shm_reclen */
...
...
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