Skip to content

Commit

Permalink
cshared: Handle already closed case
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Oct 26, 2023
1 parent f3c8347 commit 96c0484
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cshared.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ func FLBPluginInit(ptr unsafe.Pointer) int {
func flbPluginReset() {
theInputLock.Lock()
defer theInputLock.Unlock()
defer func() {
if ret := recover(); ret != nil {
fmt.Fprintf(os.Stderr, "Channel is already closed")
return
}
}()

once = sync.Once{}
close(theChannel)
Expand Down

0 comments on commit 96c0484

Please sign in to comment.