From be1610b67fcc00a0a1cc4c00fd546ca6b9a014b7 Mon Sep 17 00:00:00 2001 From: scruzin Date: Sun, 6 Jan 2019 09:37:21 +1030 Subject: [PATCH] Use unsigned ints for timeouts. --- rtmp/rtmp.go | 5 ++--- rtmp/rtmp_headers.go | 4 ++-- rtmp/session.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index eb703007..342f1369 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -135,11 +135,10 @@ var ( errConnStream = errors.New("Connection stream error") ) -func startSession(rtmp *C_RTMP, u string, timeout uint32) (*C_RTMP, error) { - connect_timeout := int32(timeout) +func startSession(rtmp *C_RTMP, u string, timeout uint) (*C_RTMP, error) { rtmp = C_RTMP_Alloc() C_RTMP_Init(rtmp) - rtmp.Link.timeout = connect_timeout + rtmp.Link.timeout = timeout err := C_RTMP_SetupURL(rtmp, u) if err != nil { C_RTMP_Close(rtmp) diff --git a/rtmp/rtmp_headers.go b/rtmp/rtmp_headers.go index 2e440713..6ae32190 100644 --- a/rtmp/rtmp_headers.go +++ b/rtmp/rtmp_headers.go @@ -140,7 +140,7 @@ type C_RTMPPacket struct { // rtmp.h +127 type C_RTMPSockBuf struct { conn *net.TCPConn - timeout int32 + timeout uint sb_size int sb_start int sb_buf [RTMP_BUFFER_CACHE_SIZE]byte // port const @@ -170,7 +170,7 @@ type C_RTMP_LNK struct { lFlags int32 swfAge int32 protocol int32 - timeout int32 + timeout uint port uint16 } diff --git a/rtmp/session.go b/rtmp/session.go index d06037e4..f07107e7 100644 --- a/rtmp/session.go +++ b/rtmp/session.go @@ -58,7 +58,7 @@ func (s *Session) Open() error { return errors.New("rtmp: attempt to start already running session") } var err error - s.rtmp, err = startSession(s.rtmp, s.url, uint32(s.timeout)) + s.rtmp, err = startSession(s.rtmp, s.url, s.timeout) if s.rtmp == nil { return err }