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
61ece1a2
Commit
61ece1a2
authored
Apr 14, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add config parameter idle.pause
parent
611ef797
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
config.c
src/config.c
+29
-7
varnishevent.c
src/varnishevent.c
+1
-3
varnishevent.h
src/varnishevent.h
+5
-1
No files found.
src/config.c
View file @
61ece1a2
...
@@ -86,6 +86,20 @@ conf_getUnsignedInt(const char *rval, unsigned *i)
...
@@ -86,6 +86,20 @@ conf_getUnsignedInt(const char *rval, unsigned *i)
return
(
0
);
return
(
0
);
}
}
static
int
conf_getDouble
(
const
char
*
rval
,
double
*
d
)
{
char
*
p
;
errno
=
0
;
double
x
=
strtod
(
rval
,
&
p
);
if
(
errno
==
ERANGE
)
return
errno
;
if
(
p
[
0
]
!=
'\0'
||
x
<
0
||
isnan
(
x
)
||
!
finite
(
x
))
return
EINVAL
;
*
d
=
x
;
return
0
;
}
#define confString(name,fld) \
#define confString(name,fld) \
if (strcmp(lval, (name)) == 0) { \
if (strcmp(lval, (name)) == 0) { \
strcpy((config.fld), rval); \
strcpy((config.fld), rval); \
...
@@ -155,17 +169,23 @@ CONF_Add(const char *lval, const char *rval)
...
@@ -155,17 +169,23 @@ CONF_Add(const char *lval, const char *rval)
}
}
if
(
strcmp
(
lval
,
"output.timeout"
)
==
0
)
{
if
(
strcmp
(
lval
,
"output.timeout"
)
==
0
)
{
char
*
p
;
double
to
;
errno
=
0
;
int
err
=
conf_getDouble
(
rval
,
&
to
);
double
to
=
strtod
(
rval
,
&
p
);
if
(
err
!=
0
)
if
(
errno
==
ERANGE
)
return
err
;
return
errno
;
if
(
p
[
0
]
!=
'\0'
||
to
<
0
||
isnan
(
to
)
||
!
finite
(
to
))
return
EINVAL
;
config
.
output_timeout
=
VTIM_timeval
(
to
);
config
.
output_timeout
=
VTIM_timeval
(
to
);
return
(
0
);
return
(
0
);
}
}
if
(
strcmp
(
lval
,
"idle.pause"
)
==
0
)
{
double
pause
;
int
err
=
conf_getDouble
(
rval
,
&
pause
);
if
(
err
!=
0
)
return
err
;
config
.
idle_pause
=
pause
;
return
(
0
);
}
return
EINVAL
;
return
EINVAL
;
}
}
...
@@ -221,6 +241,7 @@ CONF_Init(void)
...
@@ -221,6 +241,7 @@ CONF_Init(void)
config
.
chunk_size
=
DEFAULT_CHUNK_SIZE
;
config
.
chunk_size
=
DEFAULT_CHUNK_SIZE
;
config
.
housekeep_interval
=
DEFAULT_HOUSEKEEP_INTERVAL
;
config
.
housekeep_interval
=
DEFAULT_HOUSEKEEP_INTERVAL
;
config
.
ttl
=
DEFAULT_TTL
;
config
.
ttl
=
DEFAULT_TTL
;
config
.
idle_pause
=
DEFAULT_IDLE_PAUSE
;
/* Default is stdout */
/* Default is stdout */
config
.
output_file
[
0
]
=
'\0'
;
config
.
output_file
[
0
]
=
'\0'
;
...
@@ -320,6 +341,7 @@ CONF_Dump(void)
...
@@ -320,6 +341,7 @@ CONF_Dump(void)
confdump
(
"max.data = %u"
,
config
.
max_data
);
confdump
(
"max.data = %u"
,
config
.
max_data
);
confdump
(
"housekeep.interval = %u"
,
config
.
housekeep_interval
);
confdump
(
"housekeep.interval = %u"
,
config
.
housekeep_interval
);
confdump
(
"ttl = %u"
,
config
.
ttl
);
confdump
(
"ttl = %u"
,
config
.
ttl
);
confdump
(
"idle.pause = %d"
,
config
.
idle_pause
);
confdump
(
"output.bufsiz = %u"
,
config
.
output_bufsiz
);
confdump
(
"output.bufsiz = %u"
,
config
.
output_bufsiz
);
confdump
(
"user = %s"
,
config
.
user_name
);
confdump
(
"user = %s"
,
config
.
user_name
);
}
}
src/varnishevent.c
View file @
61ece1a2
...
@@ -681,9 +681,7 @@ main(int argc, char *argv[])
...
@@ -681,9 +681,7 @@ main(int argc, char *argv[])
continue
;
continue
;
case
DISPATCH_EOL
:
case
DISPATCH_EOL
:
take_free
();
take_free
();
#if 0
VTIM_sleep
(
config
.
idle_pause
);
TIM_sleep(config.idle_pause);
#endif
continue
;
continue
;
case
DISPATCH_TERMINATE
:
case
DISPATCH_TERMINATE
:
assert
(
term
==
1
);
assert
(
term
==
1
);
...
...
src/varnishevent.h
View file @
61ece1a2
...
@@ -61,6 +61,8 @@
...
@@ -61,6 +61,8 @@
#define DEFAULT_MAX_DATA 4096
#define DEFAULT_MAX_DATA 4096
#define DEFAULT_PID_FILE "/var/run/varnishevent.pid"
#define DEFAULT_PID_FILE "/var/run/varnishevent.pid"
#define DEFAULT_IDLE_PAUSE 0.01
#define DEFAULT_HOUSEKEEP_INTERVAL 10
#define DEFAULT_HOUSEKEEP_INTERVAL 10
#define DEFAULT_TTL 120
#define DEFAULT_TTL 120
...
@@ -171,7 +173,9 @@ struct config {
...
@@ -171,7 +173,9 @@ struct config {
char
output_file
[
PATH_MAX
];
char
output_file
[
PATH_MAX
];
unsigned
append
;
unsigned
append
;
struct
timeval
output_timeout
;
struct
timeval
output_timeout
;
double
idle_pause
;
/* VSL 'r' argument */
/* VSL 'r' argument */
char
varnish_bindump
[
BUFSIZ
];
char
varnish_bindump
[
BUFSIZ
];
...
...
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