mirror of https://bitbucket.org/ausocean/av.git
protocol/rtcp: fixed bug regarding checking of close err channel from client in routines.
This commit is contained in:
parent
d29141cf05
commit
fbcd163864
|
@ -132,8 +132,8 @@ func (c *Client) Stop() {
|
||||||
c.log(logger.Debug, pkg+"Client is stopping")
|
c.log(logger.Debug, pkg+"Client is stopping")
|
||||||
close(c.quit)
|
close(c.quit)
|
||||||
c.conn.Close()
|
c.conn.Close()
|
||||||
close(c.err)
|
|
||||||
c.wg.Wait()
|
c.wg.Wait()
|
||||||
|
close(c.err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Err provides read access to the Client err channel. This must be checked
|
// Err provides read access to the Client err channel. This must be checked
|
||||||
|
|
|
@ -166,14 +166,14 @@ func TestReceiveAndSend(t *testing.T) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
err, ok := <-c.Err()
|
||||||
case err := <-c.Err():
|
if ok {
|
||||||
const errConnClosed = "use of closed network connection"
|
const errConnClosed = "use of closed network connection"
|
||||||
if !strings.Contains(err.Error(), errConnClosed) {
|
if !strings.Contains(err.Error(), errConnClosed) {
|
||||||
t.Fatalf("error received from client error chan: %v\n", err)
|
t.Fatalf("error received from client error chan: %v\n", err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
default:
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue