rtmp: make C_RTMPSockBuf.sb_timedout a bool

This commit is contained in:
Dan Kortschak 2018-09-19 10:42:04 +09:30
parent 9b5d62a99a
commit b9fcb2202f
2 changed files with 5 additions and 5 deletions

View File

@ -354,7 +354,7 @@ func C_add_addr_info(service *C.sockaddr_in, hostname string, port uint16) (ok b
// rtmp.c +906 // rtmp.c +906
func C_RTMP_Connect0(r *C_RTMP, service *C.sockaddr) (ok bool) { func C_RTMP_Connect0(r *C_RTMP, service *C.sockaddr) (ok bool) {
on := 1 on := 1
r.m_sb.sb_timedout = 0 r.m_sb.sb_timedout = false
r.m_pausing = 0 r.m_pausing = 0
r.m_fDuration = 0 r.m_fDuration = 0
@ -590,7 +590,7 @@ func C_ReadN(r *C_RTMP, buffer *byte, n int) int {
var avail int var avail int
var ptr *byte var ptr *byte
r.m_sb.sb_timedout = 0 r.m_sb.sb_timedout = false
ptr = buffer ptr = buffer
@ -601,7 +601,7 @@ func C_ReadN(r *C_RTMP, buffer *byte, n int) int {
avail = int(r.m_sb.sb_size) avail = int(r.m_sb.sb_size)
if avail == 0 { if avail == 0 {
if C_RTMPSockBuf_Fill(&r.m_sb) < 1 { if C_RTMPSockBuf_Fill(&r.m_sb) < 1 {
if r.m_sb.sb_timedout == 0 { if !r.m_sb.sb_timedout {
return 0 return 0
} }
} }
@ -1809,7 +1809,7 @@ func C_RTMPSockBuf_Fill(sb *C_RTMPSockBuf) int {
if nBytes == -1 { if nBytes == -1 {
log.Printf("C_RTMPSockBuf_Fill: recv error: %v", err) log.Printf("C_RTMPSockBuf_Fill: recv error: %v", err)
if err == syscall.EWOULDBLOCK || err == syscall.EAGAIN { if err == syscall.EWOULDBLOCK || err == syscall.EAGAIN {
sb.sb_timedout = 1 sb.sb_timedout = true
nBytes = 0 nBytes = 0
} }
} else { } else {

View File

@ -140,7 +140,7 @@ type C_RTMPSockBuf struct {
sb_size int32 sb_size int32
sb_start *byte sb_start *byte
sb_buf [RTMP_BUFFER_CACHE_SIZE]byte // port const sb_buf [RTMP_BUFFER_CACHE_SIZE]byte // port const
sb_timedout int32 sb_timedout bool
} }
// RTMPPacket_IsReady(a) // RTMPPacket_IsReady(a)