From 89d9bf3eef7b91ae9d98f1e0bbafd5b0aa125926 Mon Sep 17 00:00:00 2001 From: scruzin Date: Sun, 20 Jan 2019 10:28:05 +1030 Subject: [PATCH] Return errors from the loop in connect() rather than breaking. --- rtmp/rtmp.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 3352558a..6f666785 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -192,14 +192,14 @@ func connect(c *Conn) error { c.log(WarnLevel, pkg+"sendConnect failed", "error", err.Error()) return err } - c.log(DebugLevel, pkg+"negotiating") + c.log(DebugLevel, pkg+"negotiating") var buf [256]byte for !c.isPlaying { pkt := packet{buf: buf[:]} err = pkt.readFrom(c) if err != nil { - break + return err } switch pkt.packetType { @@ -208,14 +208,10 @@ func connect(c *Conn) error { default: err = handlePacket(c, &pkt) if err != nil { - break + return err } } } - - if !c.isPlaying { - return err - } return nil }