From 563897eb8c6aad2d6118017b1081c727c56a151f Mon Sep 17 00:00:00 2001 From: Trek H Date: Fri, 18 Feb 2022 10:13:16 +1030 Subject: [PATCH] alsa: error handling --- device/alsa/alsa.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/device/alsa/alsa.go b/device/alsa/alsa.go index e372d3a2..bb1f1125 100644 --- a/device/alsa/alsa.go +++ b/device/alsa/alsa.go @@ -377,7 +377,10 @@ func (d *ALSA) input() { d.dev.Close() d.dev = nil } - d.buf.Close() + err := d.buf.Close() + if err != nil { + d.l.Log(logger.Error, "unable to close pool buffer", "error", err) + } return } @@ -418,7 +421,7 @@ func (d *ALSA) Read(p []byte) (int, error) { _, err := d.buf.Next(rbNextTimeout) if err != nil { switch err { - case nil, io.EOF: + case io.EOF: d.l.Log(logger.Debug, pkg+"EOF from Next") return 0, err case pool.ErrTimeout: @@ -435,7 +438,7 @@ func (d *ALSA) Read(p []byte) (int, error) { n, err := d.buf.Read(p) if err != nil { switch err { - case nil, io.EOF: + case io.EOF: d.l.Log(logger.Debug, pkg+"EOF from Read") return n, err default: