Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
ce8ee831
Commit
ce8ee831
authored
Mar 08, 2016
by
Pieter Raubenheimer
Committed by
Pieter Raubenheimer
Mar 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for per-host maximum connections
parent
741d7685
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
middleware/proxy/upstream.go
middleware/proxy/upstream.go
+15
-0
No files found.
middleware/proxy/upstream.go
View file @
ce8ee831
...
...
@@ -27,6 +27,7 @@ type staticUpstream struct {
FailTimeout
time
.
Duration
MaxFails
int32
MaxConns
int64
HealthCheck
struct
{
Path
string
Interval
time
.
Duration
...
...
@@ -47,6 +48,7 @@ func NewStaticUpstreams(c parse.Dispenser) ([]Upstream, error) {
Policy
:
&
Random
{},
FailTimeout
:
10
*
time
.
Second
,
MaxFails
:
1
,
MaxConns
:
0
,
}
if
!
c
.
Args
(
&
upstream
.
from
)
{
...
...
@@ -78,6 +80,10 @@ func NewStaticUpstreams(c parse.Dispenser) ([]Upstream, error) {
ExtraHeaders
:
upstream
.
proxyHeaders
,
CheckDown
:
func
(
upstream
*
staticUpstream
)
UpstreamHostDownFunc
{
return
func
(
uh
*
UpstreamHost
)
bool
{
if
upstream
.
MaxConns
!=
0
&&
uh
.
Conns
>=
upstream
.
MaxConns
{
return
true
}
if
uh
.
Unhealthy
{
return
true
}
...
...
@@ -147,6 +153,15 @@ func parseBlock(c *parse.Dispenser, u *staticUpstream) error {
return
err
}
u
.
MaxFails
=
int32
(
n
)
case
"max_conns"
:
if
!
c
.
NextArg
()
{
return
c
.
ArgErr
()
}
n
,
err
:=
strconv
.
ParseInt
(
c
.
Val
(),
10
,
64
)
if
err
!=
nil
{
return
err
}
u
.
MaxConns
=
n
case
"health_check"
:
if
!
c
.
NextArg
()
{
return
c
.
ArgErr
()
...
...
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