mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 06:46:42 +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:
@@ -626,9 +626,9 @@ func (ss *ServerSession) run() {
|
||||
|
||||
func (ss *ServerSession) runInner() error {
|
||||
for {
|
||||
chWriterError := func() chan error {
|
||||
if ss.writer != nil {
|
||||
return ss.writer.chError
|
||||
chWriterError := func() chan struct{} {
|
||||
if ss.writer != nil && ss.writer.running {
|
||||
return ss.writer.stopped
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
@@ -729,8 +729,8 @@ func (ss *ServerSession) runInner() error {
|
||||
|
||||
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
||||
|
||||
case err := <-chWriterError:
|
||||
return err
|
||||
case <-chWriterError:
|
||||
return ss.writer.stopError
|
||||
|
||||
case <-ss.ctx.Done():
|
||||
return liberrors.ErrServerTerminated{}
|
||||
@@ -1306,7 +1306,6 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
||||
}
|
||||
|
||||
ss.writer.stop()
|
||||
ss.writer = nil
|
||||
|
||||
ss.timeDecoder = nil
|
||||
|
||||
|
Reference in New Issue
Block a user