protocol/rtcp: fixed bug regarding checking of close err channel from client in routines.

This commit is contained in:
Saxon 2019-05-21 17:07:28 +09:30
parent d29141cf05
commit fbcd163864
2 changed files with 5 additions and 5 deletions

View File

@ -132,8 +132,8 @@ func (c *Client) Stop() {
c.log(logger.Debug, pkg+"Client is stopping")
close(c.quit)
c.conn.Close()
close(c.err)
c.wg.Wait()
close(c.err)
}
// Err provides read access to the Client err channel. This must be checked

View File

@ -166,14 +166,14 @@ func TestReceiveAndSend(t *testing.T) {
go func() {
for {
select {
case err := <-c.Err():
err, ok := <-c.Err()
if ok {
const errConnClosed = "use of closed network connection"
if !strings.Contains(err.Error(), errConnClosed) {
t.Fatalf("error received from client error chan: %v\n", err)
}
default:
} else {
return
}
}
}()