mirror of https://bitbucket.org/ausocean/av.git
Warn about EOF errors.
This commit is contained in:
parent
076a9c030a
commit
e772d37a1b
|
@ -35,6 +35,7 @@ LICENSE
|
||||||
package rtmp
|
package rtmp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -101,6 +102,9 @@ func readPacket(s *Session, pkt *packet) error {
|
||||||
err := readN(s, header[:1])
|
err := readN(s, header[:1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log(DebugLevel, pkg+"failed to read packet header 1st byte", "error", err.Error())
|
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
|
return err
|
||||||
}
|
}
|
||||||
pkt.headerType = (header[0] & 0xc0) >> 6
|
pkt.headerType = (header[0] & 0xc0) >> 6
|
||||||
|
@ -415,7 +419,6 @@ func sendPacket(s *Session, pkt *packet, queue bool) error {
|
||||||
if s.deferred != nil {
|
if s.deferred != nil {
|
||||||
// Prepend the previously deferred packet and write it with the current one.
|
// Prepend the previously deferred packet and write it with the current one.
|
||||||
bytes = append(s.deferred, bytes...)
|
bytes = append(s.deferred, bytes...)
|
||||||
s.deferred = nil
|
|
||||||
}
|
}
|
||||||
err := writeN(s, bytes)
|
err := writeN(s, bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue