Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logReadCloser: ensure EOF after Close() #3034

Merged
merged 2 commits into from
Jan 19, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
logReadCloser: ensure loop terminates if channels are closed
Adding the !EOF check to the loop condition ensures not reading from closed channels.
  • Loading branch information
Roberto Bruggemann committed Jan 19, 2018
commit 9198f6b38bde3e9e852a1b373466cbb687edb207
2 changes: 1 addition & 1 deletion probe/kubernetes/logreadcloser.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (l *logReadCloser) Read(p []byte) (int, error) {

// check if there's more data to read, without blocking
empty := false
for !empty && l.buffer.Len() < len(p) {
for !empty && l.buffer.Len() < len(p) && !l.isEOF() {
select {
case data := <-l.dataChannel:
l.buffer.Write(data)
Expand Down