Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdfp-pipe
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
libvdfp-pipe
Commits
7c4b4a58
Commit
7c4b4a58
authored
Aug 06, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify setting the default buffer size.
parent
104b0069
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
vdfp_pipe.c
src/vdfp_pipe.c
+11
-18
No files found.
src/vdfp_pipe.c
View file @
7c4b4a58
...
...
@@ -55,6 +55,13 @@
/* == default first_byte_ and between_bytes_timeout (in ms) */
#define TIMEOUT_MS 60000
/* XXX make bufsz configurable per object (and at runtime?) */
#ifdef PIPE_BUF
#define DEFAULT_BUFSZ ((size_t)PIPE_BUF)
#else
#define DEFAULT_BUFSZ ((size_t)4096)
#endif
struct
VPFX
(
pipe_vdp
)
{
unsigned
magic
;
#define PIPE_VDP_MAGIC 0xa887d6c3
...
...
@@ -104,11 +111,6 @@ struct vdp_state {
int
chlderr
;
};
/* XXX make bufsz configurable per object (and at runtime?) */
static
size_t
default_bufsz
=
0
;
#define DEFAULT_DEFAULT_BUFSZ (4096)
/* VDP */
static
inline
int
...
...
@@ -167,10 +169,10 @@ vdp_init(struct req *req, void **priv)
"state: %s"
,
obj
->
name
,
vstrerror
(
errno
));
return
(
-
1
);
}
state
->
buf
=
malloc
(
default_bufsz
);
state
->
buf
=
malloc
(
DEFAULT_BUFSZ
);
if
(
state
->
buf
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot allocate "
"buffer size %zd: %s"
,
obj
->
name
,
default_bufsz
,
"buffer size %zd: %s"
,
obj
->
name
,
DEFAULT_BUFSZ
,
vstrerror
(
errno
));
return
(
-
1
);
}
...
...
@@ -412,7 +414,7 @@ rw_child(struct req *req, struct vdp_state *state, enum vdp_action act,
continue
;
}
errno
=
0
;
nbytes
=
read
(
fds
[
i
].
fd
,
state
->
buf
,
default_bufsz
);
nbytes
=
read
(
fds
[
i
].
fd
,
state
->
buf
,
DEFAULT_BUFSZ
);
if
(
nbytes
<
0
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s:"
" error reading %s from %s: %s"
,
...
...
@@ -509,16 +511,6 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
AN
(
priv
);
switch
(
e
)
{
case
VCL_EVENT_LOAD
:
if
(
default_bufsz
==
0
)
{
#ifdef PIPE_BUF
default_bufsz
=
PIPE_BUF
;
#else
default_bufsz
=
DEFAULT_DEFAULT_BUFSZ
;
#endif
AN
(
default_bufsz
);
}
return
(
0
);
case
VCL_EVENT_DISCARD
:
AN
(
ctx
->
vcl
);
map
=
VRBT_MIN
(
vdp_tree
,
&
tree_h
);
...
...
@@ -537,6 +529,7 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
}
}
return
(
0
);
case
VCL_EVENT_LOAD
:
case
VCL_EVENT_WARM
:
case
VCL_EVENT_COLD
:
return
(
0
);
...
...
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