From 72e74b6456c147f5988705a5cb03ae94227e192c Mon Sep 17 00:00:00 2001 From: Paxx <50495900+Paxx-RnD@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:45:34 +0200 Subject: [PATCH] api: fix crash when retrieving RTMP and SRT connections (#2430) Co-authored-by: Paxx --- internal/core/rtmp_conn.go | 2 +- internal/core/srt_conn.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/core/rtmp_conn.go b/internal/core/rtmp_conn.go index b263d4e9..f7dca5bf 100644 --- a/internal/core/rtmp_conn.go +++ b/internal/core/rtmp_conn.go @@ -644,7 +644,7 @@ func (c *rtmpConn) apiItem() *apiRTMPConn { bytesReceived := uint64(0) bytesSent := uint64(0) - if c.conn != nil { + if c.rconn != nil { bytesReceived = c.rconn.BytesReceived() bytesSent = c.rconn.BytesSent() } diff --git a/internal/core/srt_conn.go b/internal/core/srt_conn.go index 96bcc6b4..860c994d 100644 --- a/internal/core/srt_conn.go +++ b/internal/core/srt_conn.go @@ -697,7 +697,7 @@ func (c *srtConn) apiItem() *apiSRTConn { bytesReceived := uint64(0) bytesSent := uint64(0) - if c.conn != nil { + if c.sconn != nil { var s srt.Statistics c.sconn.Stats(&s) bytesReceived = s.Accumulated.ByteRecv