From e772d37a1b383ff77a6207f4e95a96d42ab3c799 Mon Sep 17 00:00:00 2001 From: scruzin Date: Thu, 10 Jan 2019 12:48:31 +1030 Subject: [PATCH] Warn about EOF errors. --- rtmp/packet.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtmp/packet.go b/rtmp/packet.go index 8980cf5d..79bd99fe 100644 --- a/rtmp/packet.go +++ b/rtmp/packet.go @@ -35,6 +35,7 @@ LICENSE package rtmp import ( + "io" "encoding/binary" ) @@ -101,6 +102,9 @@ func readPacket(s *Session, pkt *packet) error { err := readN(s, header[:1]) if err != nil { s.log(DebugLevel, pkg+"failed to read packet header 1st byte", "error", err.Error()) + if err == io.EOF { + s.log(WarnLevel, pkg+"EOF error; connection likely terminated") + } return err } pkt.headerType = (header[0] & 0xc0) >> 6 @@ -415,7 +419,6 @@ func sendPacket(s *Session, pkt *packet, queue bool) error { if s.deferred != nil { // Prepend the previously deferred packet and write it with the current one. bytes = append(s.deferred, bytes...) - s.deferred = nil } err := writeN(s, bytes) if err != nil {