Additional logging.

This commit is contained in:
scruzin 2019-01-09 17:33:19 +10:30
parent 88e1415b10
commit 0a69c59f50
3 changed files with 6 additions and 4 deletions

View File

@ -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})

View File

@ -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:

View File

@ -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 {