From 0a69c59f5059f30730e056f19734edd487fda598 Mon Sep 17 00:00:00 2001 From: scruzin Date: Wed, 9 Jan 2019 17:33:19 +1030 Subject: [PATCH] Additional logging. --- rtmp/packet.go | 4 ++-- rtmp/rtmp.go | 4 ++-- rtmp/session.go | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rtmp/packet.go b/rtmp/packet.go index d97d99ea..9589dc6b 100644 --- a/rtmp/packet.go +++ b/rtmp/packet.go @@ -390,7 +390,7 @@ func sendPacket(s *Session, pkt *packet, queue bool) error { size := int(pkt.bodySize) chunkSize := int(s.outChunkSize) - s.log(DebugLevel, pkg+"sending packet", "la", s.link.conn.LocalAddr(), "ra", s.link.conn.RemoteAddr(), "size", size) + s.log(DebugLevel, pkg+"sending packet", "size", size, "la", s.link.conn.LocalAddr(), "ra", s.link.conn.RemoteAddr()) if s.deferred != nil && len(s.deferred)+size+hSize > chunkSize { err := writeN(s, s.deferred) @@ -456,9 +456,9 @@ func sendPacket(s *Session, pkt *packet, queue bool) error { if pkt.packetType == RTMP_PACKET_TYPE_INVOKE { buf := pkt.body[1:] meth := C_AMF_DecodeString(buf) - s.log(DebugLevel, "invoking method", "method", meth) // keep it in call queue till result arrives if queue { + s.log(DebugLevel, pkg+"queuing method "+meth) buf = buf[3+len(meth):] txn := int32(C_AMF_DecodeNumber(buf[:8])) s.methodCalls = append(s.methodCalls, method{name: meth, num: txn}) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 35084bb0..c4a15108 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -285,7 +285,7 @@ func readN(s *Session, buf []byte) error { } n, err := io.ReadFull(s.link.conn, buf) if err != nil { - s.log(WarnLevel, pkg+"read failed", "error", err.Error()) + s.log(DebugLevel, pkg+"read failed", "error", err.Error()) s.close() return err } @@ -710,7 +710,7 @@ func handleInvoke(s *Session, body []byte) error { s.log(WarnLevel, pkg+"received result without matching request", "id", txn) goto leave } - s.log(DebugLevel, pkg+"received result for method", "id", txn) + s.log(DebugLevel, pkg+"received result for "+methodInvoked) switch methodInvoked { case av_connect: diff --git a/rtmp/session.go b/rtmp/session.go index a04f39d5..fe548e75 100644 --- a/rtmp/session.go +++ b/rtmp/session.go @@ -98,6 +98,7 @@ func (s *Session) Open() error { // start does the heavylifting for Open(). func (s *Session) start() error { + s.log(DebugLevel, pkg+"Session.start") s.init() err := setupURL(s, s.url) if err != nil { @@ -146,6 +147,7 @@ func (s *Session) Close() error { // close does the heavylifting for Close(). // Any errors are ignored as it is often called in response to an earlier error. func (s *Session) close() { + s.log(DebugLevel, pkg+"Session.close") if s.isConnected() { if s.streamID > 0 { if s.link.protocol&RTMP_FEATURE_WRITE != 0 {