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
9618aa15
Commit
9618aa15
authored
Sep 23, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use dir->gethdrs() as far down as we can, then switch to getfd().
parent
44aca24d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
38 deletions
+49
-38
cache_backend.c
bin/varnishd/cache/cache_backend.c
+47
-31
cache_http1_fetch.c
bin/varnishd/cache/cache_http1_fetch.c
+2
-7
No files found.
bin/varnishd/cache/cache_backend.c
View file @
9618aa15
...
...
@@ -42,7 +42,6 @@
#include "cache_backend.h"
#include "vrt.h"
#include "vtcp.h"
#include "vtim.h"
static
struct
mempool
*
vbcpool
;
...
...
@@ -356,35 +355,6 @@ VBE_DiscardHealth(const struct director *vdi)
VBP_Remove
(
vs
->
backend
,
vs
->
vrt
->
probe
);
}
/*--------------------------------------------------------------------
*/
int
VDI_GetHdr
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
int
i
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
if
(
bo
->
director
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"No backend"
);
return
(
-
1
);
}
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
/*
* If we recycle a backend connection, there is a finite chance
* that the backend closed it before we get a request to it.
* Do a single retry in that case.
*/
if
(
i
==
1
)
{
VSC_C_main
->
backend_retry
++
;
i
=
VDI_GetHdr
(
wrk
,
bo
);
}
return
(
i
);
}
/*--------------------------------------------------------------------
*
*/
...
...
@@ -425,11 +395,57 @@ static int __match_proto__(vdi_gethdrs_f)
vdi_simple_gethdrs
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
int
i
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
return
(
-
1
);
bo
->
vbc
=
VDI_GetFd
(
bo
);
if
(
bo
->
vbc
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"no backend connection"
);
return
(
-
1
);
}
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
/*
* If we recycle a backend connection, there is a finite chance
* that the backend closed it before we get a request to it.
* Do a single retry in that case.
*/
if
(
i
==
1
)
{
VSC_C_main
->
backend_retry
++
;
bo
->
vbc
=
VDI_GetFd
(
bo
);
if
(
bo
->
vbc
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"no backend connection"
);
return
(
-
1
);
}
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
}
return
(
i
);
}
/*--------------------------------------------------------------------
*/
int
VDI_GetHdr
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
if
(
bo
->
director
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"No backend"
);
return
(
-
1
);
}
CHECK_OBJ_NOTNULL
(
bo
->
director
,
DIRECTOR_MAGIC
);
if
(
bo
->
director
->
gethdrs
!=
NULL
)
return
(
bo
->
director
->
gethdrs
(
bo
->
director
,
wrk
,
bo
));
else
return
(
vdi_simple_gethdrs
(
bo
->
director
,
wrk
,
bo
));
}
/*--------------------------------------------------------------------*/
...
...
bin/varnishd/cache/cache_http1_fetch.c
View file @
9618aa15
...
...
@@ -87,16 +87,11 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
director
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
vbc
,
VBC_MAGIC
);
CHECK_OBJ_ORNULL
(
bo
->
req
,
REQ_MAGIC
);
htc
=
bo
->
htc
;
htc
=
bo
->
htc
;
hp
=
bo
->
bereq
;
bo
->
vbc
=
VDI_GetFd
(
bo
);
if
(
bo
->
vbc
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"no backend connection"
);
return
(
-
1
);
}
vc
=
bo
->
vbc
;
if
(
vc
->
recycled
)
retry
=
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