Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-selector
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
libvmod-selector
Commits
50c4a935
Commit
50c4a935
authored
Feb 02, 2021
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vcl_init PRIV_TASK only needs to save the PRIV_VCL object once.
parent
749b0a4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
25 deletions
+43
-25
vmod_selector.c
src/vmod_selector.c
+43
-25
No files found.
src/vmod_selector.c
View file @
50c4a935
...
...
@@ -108,12 +108,18 @@ struct set_init_task {
#define SET_INIT_TASK_MAGIC 0xeae8c785
VSLIST_ENTRY
(
set_init_task
)
list
;
struct
vmod_selector_set
*
set
;
struct
vsc_head
*
vsc_head
;
unsigned
create_stats
;
};
VSLIST_HEAD
(
set_init_head
,
set_init_task
);
struct
set_init_priv
{
unsigned
magic
;
#define SET_INIT_PRIV_MAGIC 0x525e8fef
struct
set_init_head
*
task_head
;
struct
vsc_head
*
vsc_head
;
};
/* Event function */
int
...
...
@@ -340,27 +346,28 @@ create_stats(VRT_CTX, struct vmod_selector_set *set, struct vsc_head *vsc_head)
}
static
void
set_complete_init
(
VRT_CTX
,
void
*
priv
)
set_complete_init
(
VRT_CTX
,
void
*
priv
_task
)
{
struct
set_init_
head
*
head
;
struct
set_init_
priv
*
priv
;
struct
set_init_task
*
task
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
priv
);
head
=
priv
;
AZ
(
VSLIST_EMPTY
(
head
));
priv
=
priv_task
;
CHECK_OBJ_NOTNULL
(
priv
,
SET_INIT_PRIV_MAGIC
);
AN
(
priv
->
vsc_head
);
AN
(
priv
->
task_head
);
AZ
(
VSLIST_EMPTY
(
priv
->
task_head
));
VSLIST_FOREACH
(
task
,
head
,
list
)
{
VSLIST_FOREACH
(
task
,
priv
->
task_
head
,
list
)
{
CHECK_OBJ_NOTNULL
(
task
,
SET_INIT_TASK_MAGIC
);
CHECK_OBJ_NOTNULL
(
task
->
set
,
VMOD_SELECTOR_SET_MAGIC
);
AN
(
task
->
vsc_head
);
if
(
task
->
set
->
hash
==
NULL
)
if
(
compile
(
ctx
,
task
->
set
,
" set initialization"
)
!=
0
)
return
;
if
(
task
->
create_stats
)
create_stats
(
ctx
,
task
->
set
,
task
->
vsc_head
);
create_stats
(
ctx
,
task
->
set
,
priv
->
vsc_head
);
}
}
...
...
@@ -376,7 +383,7 @@ vmod_set__init(VRT_CTX, struct vmod_selector_set **setp, const char *vcl_name,
VCL_BOOL
case_sensitive
,
VCL_BOOL
allow_overlaps
)
{
struct
vmod_selector_set
*
set
;
struct
set_init_
head
*
task_head
;
struct
set_init_
priv
*
init_priv
;
struct
set_init_task
*
task
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
...
...
@@ -404,20 +411,31 @@ vmod_set__init(VRT_CTX, struct vmod_selector_set **setp, const char *vcl_name,
}
if
(
priv_task
->
priv
==
NULL
)
{
if
((
task_head
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
task_head
)))
if
((
init_priv
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
init_priv
)))
==
NULL
)
{
VERRNOMEM
(
ctx
,
"insufficient workspace for task "
"private data initializing %s"
,
vcl_name
);
return
;
}
INIT_OBJ
(
init_priv
,
SET_INIT_PRIV_MAGIC
);
if
((
init_priv
->
task_head
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
init_priv
->
task_head
)))
==
NULL
)
{
VERRNOMEM
(
ctx
,
"insufficient workspace for task "
"head initializing %s"
,
vcl_name
);
return
;
}
VSLIST_INIT
(
task_head
);
priv_task
->
priv
=
task_head
;
priv_task
->
len
=
sizeof
(
*
task
);
VSLIST_INIT
(
init_priv
->
task_head
);
init_priv
->
vsc_head
=
priv_vcl
->
priv
;
priv_task
->
priv
=
init_priv
;
priv_task
->
len
=
sizeof
(
*
init_priv
);
priv_task
->
methods
=
set_init
;
}
else
{
AN
(
priv_task
->
methods
);
task_head
=
priv_task
->
priv
;
init_priv
=
priv_task
->
priv
;
CHECK_OBJ_NOTNULL
(
init_priv
,
SET_INIT_PRIV_MAGIC
);
AN
(
init_priv
->
task_head
);
AN
(
init_priv
->
vsc_head
);
}
if
((
task
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
task
)))
==
NULL
)
{
...
...
@@ -425,11 +443,10 @@ vmod_set__init(VRT_CTX, struct vmod_selector_set **setp, const char *vcl_name,
vcl_name
);
return
;
}
task
->
magic
=
SET_INIT_TASK_MAGIC
;
INIT_OBJ
(
task
,
SET_INIT_TASK_MAGIC
)
;
task
->
set
=
set
;
task
->
vsc_head
=
priv_vcl
->
priv
;
task
->
create_stats
=
0
;
VSLIST_INSERT_HEAD
(
task_head
,
task
,
list
);
AZ
(
task
->
create_stats
);
VSLIST_INSERT_HEAD
(
init_priv
->
task_head
,
task
,
list
);
AZ
(
set
->
table
);
AZ
(
set
->
members
);
...
...
@@ -1060,8 +1077,8 @@ VCL_VOID
vmod_set_create_stats
(
VRT_CTX
,
struct
vmod_selector_set
*
set
,
struct
vmod_priv
*
priv
)
{
struct
set_init_
task
*
task
;
struct
set_init_
head
*
task_head
;
struct
set_init_
priv
*
init_priv
;
struct
set_init_
task
*
task
=
NULL
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
set
,
VMOD_SELECTOR_SET_MAGIC
);
...
...
@@ -1073,10 +1090,11 @@ vmod_set_create_stats(VRT_CTX, struct vmod_selector_set *set,
}
AN
(
priv
);
AN
(
priv
->
priv
);
task_head
=
priv
->
priv
;
AZ
(
VSLIST_EMPTY
(
task_head
));
init_priv
=
priv
->
priv
;
CHECK_OBJ_NOTNULL
(
init_priv
,
SET_INIT_PRIV_MAGIC
);
AZ
(
VSLIST_EMPTY
(
init_priv
->
task_head
));
VSLIST_FOREACH
(
task
,
task_head
,
list
)
{
VSLIST_FOREACH
(
task
,
init_priv
->
task_head
,
list
)
{
CHECK_OBJ_NOTNULL
(
task
,
SET_INIT_TASK_MAGIC
);
CHECK_OBJ_NOTNULL
(
task
->
set
,
VMOD_SELECTOR_SET_MAGIC
);
if
(
task
->
set
==
set
)
...
...
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