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
4f5df39b
Commit
4f5df39b
authored
Oct 30, 2018
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy: Re-invoke listener middlewares on reloads and upgrades
parent
1f8d1df4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
caddy.go
caddy.go
+7
-0
caddyhttp/httpserver/server.go
caddyhttp/httpserver/server.go
+14
-4
No files found.
caddy.go
View file @
4f5df39b
...
@@ -388,6 +388,11 @@ type GracefulServer interface {
...
@@ -388,6 +388,11 @@ type GracefulServer interface {
// address; you must store the address the
// address; you must store the address the
// server is to serve on some other way.
// server is to serve on some other way.
Address
()
string
Address
()
string
// WrapListener wraps a listener with the
// listener middlewares configured for this
// server, if any.
WrapListener
(
net
.
Listener
)
net
.
Listener
}
}
// Listener is a net.Listener with an underlying file descriptor.
// Listener is a net.Listener with an underlying file descriptor.
...
@@ -744,6 +749,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
...
@@ -744,6 +749,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
return
err
return
err
}
}
}
}
ln
=
gs
.
WrapListener
(
ln
)
}
}
}
}
...
@@ -782,6 +788,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
...
@@ -782,6 +788,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
return
err
return
err
}
}
}
}
ln
=
gs
.
WrapListener
(
ln
)
}
}
}
}
...
...
caddyhttp/httpserver/server.go
View file @
4f5df39b
...
@@ -274,16 +274,26 @@ func (s *Server) Listen() (net.Listener, error) {
...
@@ -274,16 +274,26 @@ func (s *Server) Listen() (net.Listener, error) {
ln
=
tcpKeepAliveListener
{
TCPListener
:
tcpLn
}
ln
=
tcpKeepAliveListener
{
TCPListener
:
tcpLn
}
}
}
cln
:=
s
.
WrapListener
(
ln
)
// Very important to return a concrete caddy.Listener
// implementation for graceful restarts.
return
cln
.
(
caddy
.
Listener
),
nil
}
// WrapListener wraps ln in the listener middlewares configured
// for this server.
func
(
s
*
Server
)
WrapListener
(
ln
net
.
Listener
)
net
.
Listener
{
if
ln
==
nil
{
return
nil
}
cln
:=
ln
.
(
caddy
.
Listener
)
cln
:=
ln
.
(
caddy
.
Listener
)
for
_
,
site
:=
range
s
.
sites
{
for
_
,
site
:=
range
s
.
sites
{
for
_
,
m
:=
range
site
.
listenerMiddleware
{
for
_
,
m
:=
range
site
.
listenerMiddleware
{
cln
=
m
(
cln
)
cln
=
m
(
cln
)
}
}
}
}
return
cln
// Very important to return a concrete caddy.Listener
// implementation for graceful restarts.
return
cln
.
(
caddy
.
Listener
),
nil
}
}
// ListenPacket creates udp connection for QUIC if it is enabled,
// ListenPacket creates udp connection for QUIC if it is enabled,
...
...
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