mirror of https://bitbucket.org/ausocean/av.git
rtmp: re-add recvtimeout option setting
This commit is contained in:
parent
c91896d919
commit
50884b8034
|
@ -37,6 +37,8 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// int RTMP_Connect(RTMP *r, RTMPPacket* cp);
|
||||
|
@ -66,6 +68,17 @@ func C_RTMP_Connect(r *C_RTMP, cp *C_RTMPPacket) (ok bool) {
|
|||
}
|
||||
}
|
||||
|
||||
f, err := r.m_sb.conn.File()
|
||||
if err != nil {
|
||||
log.Printf("failed to get fd to set timeout: %v", err)
|
||||
return false
|
||||
}
|
||||
tv := setTimeval(int(r.Link.timeout))
|
||||
err = unix.SetsockoptTimeval(int(f.Fd()), unix.SOL_SOCKET, unix.SO_RCVTIMEO, &tv)
|
||||
if err != nil {
|
||||
log.Printf("failed to set timeout: %v", err)
|
||||
}
|
||||
|
||||
r.m_bSendCounter = true
|
||||
|
||||
return C_RTMP_Connect1(r, cp)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package rtmp
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func setTimeval(sec int) unix.Timeval {
|
||||
return unix.Timeval{Sec: int64(sec)}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package rtmp
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func setTimeval(sec int) unix.Timeval {
|
||||
return unix.Timeval{Sec: int32(sec)}
|
||||
}
|
Loading…
Reference in New Issue