Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
dd7083a2
Commit
dd7083a2
authored
Aug 06, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make generic functions for OA's in double format.
parent
c0f7ed64
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
17 deletions
+26
-17
cache.h
bin/varnishd/cache/cache.h
+3
-2
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+2
-2
cache_obj.c
bin/varnishd/cache/cache_obj.c
+19
-12
cache_rfc2616.c
bin/varnishd/cache/cache_rfc2616.c
+2
-1
No files found.
bin/varnishd/cache/cache.h
View file @
dd7083a2
...
...
@@ -1065,8 +1065,9 @@ void *ObjSetattr(struct objcore *oc, struct dstat *ds, enum obj_attr attr,
ssize_t
len
);
int
ObjCopyAttr
(
struct
objcore
*
ocd
,
struct
objcore
*
ocs
,
struct
dstat
*
ds
,
enum
obj_attr
attr
);
int
ObjSetLastModified
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
double
t
);
double
ObjGetLastModified
(
struct
objcore
*
oc
,
struct
dstat
*
ds
);
int
ObjSetDouble
(
struct
objcore
*
,
struct
dstat
*
,
enum
obj_attr
,
double
);
int
ObjGetDouble
(
struct
objcore
*
,
struct
dstat
*
,
enum
obj_attr
,
double
*
);
/* cache_panic.c */
void
PAN_Init
(
void
);
...
...
bin/varnishd/cache/cache_fetch.c
View file @
dd7083a2
...
...
@@ -165,10 +165,10 @@ vbf_beresp2obj(struct busyobj *bo)
http_CopyHome
(
hp2
);
if
(
http_GetHdr
(
hp
,
H_Last_Modified
,
&
b
))
AZ
(
ObjSet
LastModified
(
bo
->
fetch_objcore
,
bo
->
stats
,
AZ
(
ObjSet
Double
(
bo
->
fetch_objcore
,
bo
->
stats
,
OA_LASTMODIFIED
,
VTIM_parse
(
b
)));
else
AZ
(
ObjSet
LastModified
(
bo
->
fetch_objcore
,
bo
->
stats
,
AZ
(
ObjSet
Double
(
bo
->
fetch_objcore
,
bo
->
stats
,
OA_LASTMODIFIED
,
floor
(
bo
->
fetch_objcore
->
exp
.
t_origin
)));
/* Disassociate the obj from the bo's workspace */
...
...
bin/varnishd/cache/cache_obj.c
View file @
dd7083a2
...
...
@@ -307,36 +307,43 @@ ObjGetXID(struct objcore *oc, struct dstat *ds)
}
/*--------------------------------------------------------------------
* NB: Copying double <--> uint64_t for endian encoding is unverified
* There is no well-defined byteorder for IEEE-754 double and the
* correct solution (frexp(3) and manual encoding) is more work
* than our (weak) goal of being endian-agnostic requires at this point.
* We give it a shot by memcpy'ing doubles over a uint64_t and then
* BE encode that.
*/
int
ObjSet
LastModified
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
double
t
)
ObjSet
Double
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
enum
obj_attr
a
,
double
t
)
{
void
*
vp
;
uint64_t
u
;
assert
(
sizeof
t
==
sizeof
u
);
memcpy
(
&
u
,
&
t
,
sizeof
u
);
vp
=
ObjSetattr
(
oc
,
ds
,
OA_LASTMODIFIED
,
sizeof
u
);
vp
=
ObjSetattr
(
oc
,
ds
,
a
,
sizeof
u
);
if
(
vp
==
NULL
)
return
(
-
1
);
vbe64enc
(
vp
,
u
);
return
(
0
);
}
double
ObjGet
LastModified
(
struct
objcore
*
oc
,
struct
dstat
*
ds
)
int
ObjGet
Double
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
enum
obj_attr
a
,
double
*
d
)
{
void
*
vp
;
uint64_t
u
;
double
d
;
ssize_t
l
;
vp
=
ObjGetattr
(
oc
,
ds
,
OA_LASTMODIFIED
,
&
l
);
AN
(
vp
);
assert
(
l
==
sizeof
u
);
u
=
vbe64dec
(
vp
);
memcpy
(
&
d
,
&
u
,
sizeof
d
);
return
(
d
);
assert
(
sizeof
*
d
==
sizeof
u
);
vp
=
ObjGetattr
(
oc
,
ds
,
a
,
&
l
);
if
(
vp
==
NULL
)
return
(
-
1
);
if
(
d
!=
NULL
)
{
assert
(
l
==
sizeof
u
);
u
=
vbe64dec
(
vp
);
memcpy
(
d
,
&
u
,
sizeof
*
d
);
}
return
(
0
);
}
bin/varnishd/cache/cache_rfc2616.c
View file @
dd7083a2
...
...
@@ -355,7 +355,8 @@ RFC2616_Do_Cond(const struct req *req)
ims
=
VTIM_parse
(
p
);
if
(
ims
>
req
->
t_req
)
/* [RFC2616 14.25] */
return
(
0
);
lm
=
ObjGetLastModified
(
req
->
objcore
,
&
req
->
wrk
->
stats
);
AZ
(
ObjGetDouble
(
req
->
objcore
,
&
req
->
wrk
->
stats
,
OA_LASTMODIFIED
,
&
lm
));
if
(
lm
>
ims
)
return
(
0
);
do_cond
=
1
;
...
...
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