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
c095a4d4
Commit
c095a4d4
authored
Feb 25, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make getting a backend connections IP something we ask the director
about, and return NULL if they won't tell us.
parent
9454f7b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
6 deletions
+45
-6
cache_backend.c
bin/varnishd/cache/cache_backend.c
+17
-0
cache_director.c
bin/varnishd/cache/cache_director.c
+20
-0
cache_director.h
bin/varnishd/cache/cache_director.h
+7
-2
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+1
-4
No files found.
bin/varnishd/cache/cache_backend.c
View file @
c095a4d4
...
@@ -245,11 +245,27 @@ vbe_dir_getbody(const struct director *d, struct worker *wrk,
...
@@ -245,11 +245,27 @@ vbe_dir_getbody(const struct director *d, struct worker *wrk,
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
vfc
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
htc
,
HTTP_CONN_MAGIC
);
V1F_Setup_Fetch
(
bo
->
vfc
,
bo
->
htc
);
V1F_Setup_Fetch
(
bo
->
vfc
,
bo
->
htc
);
return
(
0
);
return
(
0
);
}
}
static
const
struct
suckaddr
*
__match_proto__
(
vdi_getip_f
)
vbe_dir_getip
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
htc
,
HTTP_CONN_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
htc
->
vbc
,
VBC_MAGIC
);
return
(
bo
->
htc
->
vbc
->
addr
);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
void
static
void
...
@@ -291,6 +307,7 @@ VRT_init_vbe(VRT_CTX, struct director **dp, const struct vrt_backend *vrt)
...
@@ -291,6 +307,7 @@ VRT_init_vbe(VRT_CTX, struct director **dp, const struct vrt_backend *vrt)
d
->
healthy
=
vbe_dir_healthy
;
d
->
healthy
=
vbe_dir_healthy
;
d
->
gethdrs
=
vbe_dir_gethdrs
;
d
->
gethdrs
=
vbe_dir_gethdrs
;
d
->
getbody
=
vbe_dir_getbody
;
d
->
getbody
=
vbe_dir_getbody
;
d
->
getip
=
vbe_dir_getip
;
d
->
finish
=
vbe_dir_finish
;
d
->
finish
=
vbe_dir_finish
;
if
(
vrt
->
probe
!=
NULL
)
if
(
vrt
->
probe
!=
NULL
)
...
...
bin/varnishd/cache/cache_director.c
View file @
c095a4d4
...
@@ -106,6 +106,26 @@ VDI_GetBody(struct worker *wrk, struct busyobj *bo)
...
@@ -106,6 +106,26 @@ VDI_GetBody(struct worker *wrk, struct busyobj *bo)
return
(
d
->
getbody
(
d
,
wrk
,
bo
));
return
(
d
->
getbody
(
d
,
wrk
,
bo
));
}
}
/* Get IP number (if any ) -------------------------------------------*/
const
struct
suckaddr
*
VDI_GetIP
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
const
struct
director
*
d
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
d
=
bo
->
director_resp
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
assert
(
bo
->
director_state
==
DIR_S_HDRS
||
bo
->
director_state
==
DIR_S_BODY
);
AZ
(
d
->
resolve
);
if
(
d
->
getip
==
NULL
)
return
(
NULL
);
return
(
d
->
getip
(
d
,
wrk
,
bo
));
}
/* Finish fetch ------------------------------------------------------*/
/* Finish fetch ------------------------------------------------------*/
void
void
...
...
bin/varnishd/cache/cache_director.h
View file @
c095a4d4
...
@@ -53,6 +53,8 @@ typedef int vdi_gethdrs_f(const struct director *, struct worker *,
...
@@ -53,6 +53,8 @@ typedef int vdi_gethdrs_f(const struct director *, struct worker *,
struct
busyobj
*
);
struct
busyobj
*
);
typedef
int
vdi_getbody_f
(
const
struct
director
*
,
struct
worker
*
,
typedef
int
vdi_getbody_f
(
const
struct
director
*
,
struct
worker
*
,
struct
busyobj
*
);
struct
busyobj
*
);
typedef
const
struct
suckaddr
*
vdi_getip_f
(
const
struct
director
*
,
struct
worker
*
,
struct
busyobj
*
);
typedef
void
vdi_finish_f
(
const
struct
director
*
,
struct
worker
*
,
typedef
void
vdi_finish_f
(
const
struct
director
*
,
struct
worker
*
,
struct
busyobj
*
);
struct
busyobj
*
);
...
@@ -69,6 +71,7 @@ struct director {
...
@@ -69,6 +71,7 @@ struct director {
vdi_resolve_f
*
resolve
;
vdi_resolve_f
*
resolve
;
vdi_gethdrs_f
*
gethdrs
;
vdi_gethdrs_f
*
gethdrs
;
vdi_getbody_f
*
getbody
;
vdi_getbody_f
*
getbody
;
vdi_getip_f
*
getip
;
vdi_finish_f
*
finish
;
vdi_finish_f
*
finish
;
void
*
priv
;
void
*
priv
;
const
void
*
priv2
;
const
void
*
priv2
;
...
@@ -76,8 +79,10 @@ struct director {
...
@@ -76,8 +79,10 @@ struct director {
/* cache_director.c */
/* cache_director.c */
int
VDI_GetHdr
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
);
int
VDI_GetHdr
(
struct
worker
*
,
struct
busyobj
*
);
int
VDI_GetBody
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
);
int
VDI_GetBody
(
struct
worker
*
,
struct
busyobj
*
);
const
struct
suckaddr
*
VDI_GetIP
(
struct
worker
*
,
struct
busyobj
*
);
void
VDI_Finish
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
);
void
VDI_Finish
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
);
int
VDI_Http1Pipe
(
struct
req
*
,
struct
busyobj
*
);
int
VDI_Http1Pipe
(
struct
req
*
,
struct
busyobj
*
);
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
c095a4d4
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "common/heritage.h"
#include "common/heritage.h"
#include "hash/hash_slinger.h"
#include "hash/hash_slinger.h"
#include "cache_backend.h"
#include "cache_director.h"
#include "cache_director.h"
#include "vrt.h"
#include "vrt.h"
#include "vrt_obj.h"
#include "vrt_obj.h"
...
@@ -317,9 +316,7 @@ VRT_r_beresp_backend_ip(VRT_CTX)
...
@@ -317,9 +316,7 @@ VRT_r_beresp_backend_ip(VRT_CTX)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
if
(
ctx
->
bo
->
htc
!=
NULL
&&
ctx
->
bo
->
htc
->
vbc
!=
NULL
)
return
(
VDI_GetIP
(
ctx
->
bo
->
wrk
,
ctx
->
bo
));
return
(
ctx
->
bo
->
htc
->
vbc
->
addr
);
return
(
NULL
);
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
...
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