mirror of https://bitbucket.org/ausocean/av.git
Additional logging.
This commit is contained in:
parent
88e1415b10
commit
0a69c59f50
|
@ -390,7 +390,7 @@ func sendPacket(s *Session, pkt *packet, queue bool) error {
|
||||||
size := int(pkt.bodySize)
|
size := int(pkt.bodySize)
|
||||||
chunkSize := int(s.outChunkSize)
|
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 {
|
if s.deferred != nil && len(s.deferred)+size+hSize > chunkSize {
|
||||||
err := writeN(s, s.deferred)
|
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 {
|
if pkt.packetType == RTMP_PACKET_TYPE_INVOKE {
|
||||||
buf := pkt.body[1:]
|
buf := pkt.body[1:]
|
||||||
meth := C_AMF_DecodeString(buf)
|
meth := C_AMF_DecodeString(buf)
|
||||||
s.log(DebugLevel, "invoking method", "method", meth)
|
|
||||||
// keep it in call queue till result arrives
|
// keep it in call queue till result arrives
|
||||||
if queue {
|
if queue {
|
||||||
|
s.log(DebugLevel, pkg+"queuing method "+meth)
|
||||||
buf = buf[3+len(meth):]
|
buf = buf[3+len(meth):]
|
||||||
txn := int32(C_AMF_DecodeNumber(buf[:8]))
|
txn := int32(C_AMF_DecodeNumber(buf[:8]))
|
||||||
s.methodCalls = append(s.methodCalls, method{name: meth, num: txn})
|
s.methodCalls = append(s.methodCalls, method{name: meth, num: txn})
|
||||||
|
|
|
@ -285,7 +285,7 @@ func readN(s *Session, buf []byte) error {
|
||||||
}
|
}
|
||||||
n, err := io.ReadFull(s.link.conn, buf)
|
n, err := io.ReadFull(s.link.conn, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log(WarnLevel, pkg+"read failed", "error", err.Error())
|
s.log(DebugLevel, pkg+"read failed", "error", err.Error())
|
||||||
s.close()
|
s.close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,7 @@ func handleInvoke(s *Session, body []byte) error {
|
||||||
s.log(WarnLevel, pkg+"received result without matching request", "id", txn)
|
s.log(WarnLevel, pkg+"received result without matching request", "id", txn)
|
||||||
goto leave
|
goto leave
|
||||||
}
|
}
|
||||||
s.log(DebugLevel, pkg+"received result for method", "id", txn)
|
s.log(DebugLevel, pkg+"received result for "+methodInvoked)
|
||||||
|
|
||||||
switch methodInvoked {
|
switch methodInvoked {
|
||||||
case av_connect:
|
case av_connect:
|
||||||
|
|
|
@ -98,6 +98,7 @@ func (s *Session) Open() error {
|
||||||
|
|
||||||
// start does the heavylifting for Open().
|
// start does the heavylifting for Open().
|
||||||
func (s *Session) start() error {
|
func (s *Session) start() error {
|
||||||
|
s.log(DebugLevel, pkg+"Session.start")
|
||||||
s.init()
|
s.init()
|
||||||
err := setupURL(s, s.url)
|
err := setupURL(s, s.url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -146,6 +147,7 @@ func (s *Session) Close() error {
|
||||||
// close does the heavylifting for Close().
|
// close does the heavylifting for Close().
|
||||||
// Any errors are ignored as it is often called in response to an earlier error.
|
// Any errors are ignored as it is often called in response to an earlier error.
|
||||||
func (s *Session) close() {
|
func (s *Session) close() {
|
||||||
|
s.log(DebugLevel, pkg+"Session.close")
|
||||||
if s.isConnected() {
|
if s.isConnected() {
|
||||||
if s.streamID > 0 {
|
if s.streamID > 0 {
|
||||||
if s.link.protocol&RTMP_FEATURE_WRITE != 0 {
|
if s.link.protocol&RTMP_FEATURE_WRITE != 0 {
|
||||||
|
|
Loading…
Reference in New Issue