Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
de83eefd
Unverified
Commit
de83eefd
authored
May 01, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76784 from tedyu/health-read
Use read lock in ServeHTTP
parents
a3fd657d
9fb6a100
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
healthcheck.go
pkg/proxy/healthcheck/healthcheck.go
+4
-4
No files found.
pkg/proxy/healthcheck/healthcheck.go
View file @
de83eefd
...
@@ -122,7 +122,7 @@ type server struct {
...
@@ -122,7 +122,7 @@ type server struct {
listener
Listener
listener
Listener
httpFactory
HTTPServerFactory
httpFactory
HTTPServerFactory
lock
sync
.
Mutex
lock
sync
.
RW
Mutex
services
map
[
types
.
NamespacedName
]
*
hcInstance
services
map
[
types
.
NamespacedName
]
*
hcInstance
}
}
...
@@ -199,15 +199,15 @@ type hcHandler struct {
...
@@ -199,15 +199,15 @@ type hcHandler struct {
var
_
http
.
Handler
=
hcHandler
{}
var
_
http
.
Handler
=
hcHandler
{}
func
(
h
hcHandler
)
ServeHTTP
(
resp
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
func
(
h
hcHandler
)
ServeHTTP
(
resp
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
h
.
hcs
.
lock
.
Lock
()
h
.
hcs
.
lock
.
R
Lock
()
svc
,
ok
:=
h
.
hcs
.
services
[
h
.
name
]
svc
,
ok
:=
h
.
hcs
.
services
[
h
.
name
]
if
!
ok
||
svc
==
nil
{
if
!
ok
||
svc
==
nil
{
h
.
hcs
.
lock
.
Unlock
()
h
.
hcs
.
lock
.
R
Unlock
()
klog
.
Errorf
(
"Received request for closed healthcheck %q"
,
h
.
name
.
String
())
klog
.
Errorf
(
"Received request for closed healthcheck %q"
,
h
.
name
.
String
())
return
return
}
}
count
:=
svc
.
endpoints
count
:=
svc
.
endpoints
h
.
hcs
.
lock
.
Unlock
()
h
.
hcs
.
lock
.
R
Unlock
()
resp
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
resp
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
if
count
==
0
{
if
count
==
0
{
...
...
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