Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-vslp
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-vslp
Commits
baf1e40d
Commit
baf1e40d
authored
Jul 15, 2014
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need for sprintf in debug output - use VSLb for debug and VSL for init logging
parent
36b4bffc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
25 deletions
+10
-25
vslp_dir.c
src/vslp_dir.c
+10
-25
No files found.
src/vslp_dir.c
View file @
baf1e40d
...
...
@@ -53,17 +53,6 @@ struct vslp_state {
const
struct
vrt_ctx
*
ctx
;
};
static
void
vlog_debug
(
const
struct
vrt_ctx
*
ctx
,
char
msg
[])
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
ctx
->
vsl
);
txt
t
;
t
.
b
=
msg
;
t
.
e
=
msg
+
strlen
(
msg
);
VSLbt
(
ctx
->
vsl
,
SLT_Debug
,
t
);
}
static
int
hostnode_compare
(
struct
vslp_hostnode
*
a
,
struct
vslp_hostnode
*
b
)
{
...
...
@@ -332,11 +321,10 @@ vslpdir_init_hashcircle(struct vslpdir *vslpd, VCL_INT replicas)
{
for
(
j
=
0
;
j
<
replicas
;
j
++
)
{
//FIXME can't log due VSLbt in vcl_init
printf
(
"VSLP hashcircle[%5ld] = {point = %8x, host = %2d}
\n
"
,
i
*
replicas
+
j
,
vslpd
->
hashcircle
[
i
*
replicas
+
j
].
point
,
vslpd
->
hashcircle
[
i
*
replicas
+
j
].
host
);
VSL
(
SLT_Debug
,
0
,
"VSLP hashcircle[%5ld] = {point = %8x, host = %2d}
\n
"
,
i
*
replicas
+
j
,
vslpd
->
hashcircle
[
i
*
replicas
+
j
].
point
,
vslpd
->
hashcircle
[
i
*
replicas
+
j
].
host
);
}
}
...
...
@@ -397,6 +385,8 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
struct
vslp_state
state
;
CHECK_OBJ_NOTNULL
(
vslpd
,
VSLPDIR_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
ctx
->
vsl
);
be_choice
=
(
scalbn
(
random
(),
-
31
)
>
vslpd
->
altsrv_p
);
...
...
@@ -428,9 +418,8 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
restarts
--
;
if
(
restarts
<=
0
)
{
char
msg
[
56
];
sprintf
(
msg
,
"VSLP picked backend %2i for key %8x in restarts: %2i"
,
chosen
,
hash
,
restarts_o
);
vlog_debug
(
ctx
,
msg
);
VSLb
(
ctx
->
vsl
,
SLT_Debug
,
"VSLP picked backend %2i for key %8x in restarts: %2i"
,
chosen
,
hash
,
restarts_o
);
be
=
vslpd
->
backend
[
chosen
];
AN
(
be
);
return
be
;
...
...
@@ -454,9 +443,7 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
WRONG
(
"VSLP failed to choose a backend"
);
be
=
vslpd
->
backend
[
chosen
];
}
char
msg
[
51
];
sprintf
(
msg
,
"VSLP picked backend %2i for key %8x in healthy"
,
chosen
,
hash
);
vlog_debug
(
ctx
,
msg
);
VSLb
(
ctx
->
vsl
,
SLT_Debug
,
"VSLP picked backend %2i for key %8x in healthy"
,
chosen
,
hash
);
}
else
{
...
...
@@ -465,9 +452,7 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
if
(
chosen
<
0
)
WRONG
(
"VSLP failed to choose a backend"
);
be
=
vslpd
->
backend
[
chosen
];
char
msg
[
53
];
sprintf
(
msg
,
"VSLP picked backend %2i for key %8x in unhealthy"
,
chosen
,
hash
);
vlog_debug
(
ctx
,
msg
);
VSLb
(
ctx
->
vsl
,
SLT_Debug
,
"VSLP picked backend %2i for key %8x in unhealthy"
,
chosen
,
hash
);
}
AN
(
be
);
...
...
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