mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
client: fix panic when writing packets after connection error (#681)
* Fix writer nullpointer panic on network reconnect * add additional code and tests --------- Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
24
async_processor_test.go
Normal file
24
async_processor_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package gortsplib
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAsyncProcessorStopAfterError(t *testing.T) {
|
||||
p := &asyncProcessor{bufferSize: 8}
|
||||
p.initialize()
|
||||
|
||||
p.push(func() error {
|
||||
return fmt.Errorf("ok")
|
||||
})
|
||||
|
||||
p.start()
|
||||
|
||||
<-p.stopped
|
||||
require.EqualError(t, p.stopError, "ok")
|
||||
|
||||
p.stop()
|
||||
}
|
Reference in New Issue
Block a user