alsa: error handling

This commit is contained in:
Trek H 2022-02-18 10:13:16 +10:30
parent 78279d4405
commit 563897eb8c
1 changed files with 6 additions and 3 deletions

View File

@ -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: