Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-cluster
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-cluster
Commits
5c0551b8
Commit
5c0551b8
authored
Mar 20, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add symbolic decision return from decide()
parent
0edaf31a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
vmod_cluster.c
src/vmod_cluster.c
+25
-9
No files found.
src/vmod_cluster.c
View file @
5c0551b8
...
...
@@ -62,6 +62,12 @@ parse_resolve_e(VCL_ENUM e)
WRONG
(
"illegal resolve enum"
);
}
enum
decision_e
{
D_NULL
=
0
,
D_CLUSTER
,
D_REAL
};
struct
vmod_cluster_cluster_param
{
unsigned
magic
;
#define VMOD_CLUSTER_CLUSTER_PARAM_MAGIC 0x3ba2a0d5
...
...
@@ -450,25 +456,31 @@ real_resolve(VRT_CTX, VCL_BACKEND r, enum resolve_e resolve)
}
}
static
VCL_BACKEND
decide
(
VRT_CTX
,
const
struct
vmod_cluster_cluster_param
*
pr
,
enum
resolve_e
resolve
)
static
inline
VCL_BACKEND
decide
(
VRT_CTX
,
const
struct
vmod_cluster_cluster_param
*
pr
,
enum
resolve_e
resolve
,
enum
decision_e
*
decision
)
{
VCL_BACKEND
r
;
if
(
pr
->
direct
||
(
pr
->
uncacheable_direct
&&
ctx
->
bo
&&
(
ctx
->
bo
->
do_pass
||
ctx
->
bo
->
uncacheable
)))
return
(
real_resolve
(
ctx
,
pr
->
real
,
resolve
))
;
goto
real
;
AN
(
pr
->
cluster
);
r
=
VRT_DirectorResolve
(
ctx
,
pr
->
cluster
);
if
(
r
==
NULL
)
if
(
r
==
NULL
)
{
if
(
decision
!=
NULL
)
*
decision
=
D_NULL
;
return
(
NULL
);
}
if
(
cluster_blacklisted
(
pr
,
r
))
return
(
real_resolve
(
ctx
,
pr
->
real
,
resolve
));
goto
real
;
if
(
decision
!=
NULL
)
*
decision
=
D_CLUSTER
;
switch
(
resolve
)
{
case
SHALLOW
:
...
...
@@ -479,13 +491,17 @@ decide(VRT_CTX,
default:
WRONG
(
"illegal resolve argument"
);
}
real:
if
(
decision
!=
NULL
)
*
decision
=
D_REAL
;
return
(
real_resolve
(
ctx
,
pr
->
real
,
resolve
));
}
static
VCL_BACKEND
v_matchproto_
(
vdi_resolve_f
)
vmod_cluster_resolve
(
VRT_CTX
,
VCL_BACKEND
dir
)
{
return
(
decide
(
ctx
,
cluster_task_param_r
(
ctx
,
dir
->
priv
),
DEEP
));
cluster_task_param_r
(
ctx
,
dir
->
priv
),
DEEP
,
NULL
));
}
static
VCL_BACKEND
...
...
@@ -505,7 +521,7 @@ cluster_choose(VRT_CTX,
if
(
resolve
==
LAZY
)
return
(
vc
->
dir
);
pr
=
cluster_task_param_r
(
ctx
,
vc
);
return
(
decide
(
ctx
,
pr
,
resolve
));
return
(
decide
(
ctx
,
pr
,
resolve
,
NULL
));
}
AN
(
modify
);
...
...
@@ -549,7 +565,7 @@ cluster_choose(VRT_CTX,
if
(
resolve
==
LAZY
)
return
(
vc
->
dir
);
return
(
decide
(
ctx
,
pr
,
resolve
));
return
(
decide
(
ctx
,
pr
,
resolve
,
NULL
));
}
VCL_BACKEND
...
...
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