Skip to content

Commit

Permalink
Prevent race of contidion from panic
Browse files Browse the repository at this point in the history
Due to race of condition nextCh can be already null when we try to close it
Resolves ipfs/kubo#2732
  • Loading branch information
Kubuxu committed Jun 9, 2016
1 parent 7014ba2 commit 0b8a784
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gx/lastpubver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0: QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8
1.1.1: QmYtB7Qge8cJpXc4irsEp8zRqfnZMBeB7aTrMEkPk67DRv
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"language": "go",
"license": "",
"name": "go-log",
"version": "1.1.0"
}
"version": "1.1.1"
}
4 changes: 3 additions & 1 deletion writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ func (bw *bufWriter) loop() {
if bufsize > MaxWriterBuffer {
// if we have too many messages buffered, kill the writer
bw.die()
close(nextCh)
if nextCh != nil {
close(nextCh)
}
nextCh = nil
// explicity keep going here to drain incoming
}
Expand Down

0 comments on commit 0b8a784

Please sign in to comment.