From 5945937a5f9a22d843b43f41c075986051febdc7 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sun, 1 Nov 2020 16:57:39 +0100 Subject: [PATCH] set default read and write timeout to 10 secs --- connclient.go | 6 +++--- connserver.go | 8 ++++---- rtpaac/encoder.go | 2 +- rtph264/encoder.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/connclient.go b/connclient.go index 7682a376..fe73c81e 100644 --- a/connclient.go +++ b/connclient.go @@ -102,11 +102,11 @@ type ConnClient struct { // NewConnClient allocates a ConnClient. See ConnClientConf for the options. func NewConnClient(conf ConnClientConf) (*ConnClient, error) { - if conf.ReadTimeout == time.Duration(0) { + if conf.ReadTimeout == 0 { conf.ReadTimeout = 10 * time.Second } - if conf.WriteTimeout == time.Duration(0) { - conf.WriteTimeout = 5 * time.Second + if conf.WriteTimeout == 0 { + conf.WriteTimeout = 10 * time.Second } if conf.ReadBufferCount == 0 { conf.ReadBufferCount = 1 diff --git a/connserver.go b/connserver.go index 0117e72b..c1f91834 100644 --- a/connserver.go +++ b/connserver.go @@ -46,11 +46,11 @@ type ConnServer struct { // NewConnServer allocates a ConnServer. func NewConnServer(conf ConnServerConf) *ConnServer { - if conf.ReadTimeout == time.Duration(0) { - conf.ReadTimeout = 5 * time.Second + if conf.ReadTimeout == 0 { + conf.ReadTimeout = 10 * time.Second } - if conf.WriteTimeout == time.Duration(0) { - conf.WriteTimeout = 5 * time.Second + if conf.WriteTimeout == 0 { + conf.WriteTimeout = 10 * time.Second } if conf.ReadBufferCount == 0 { conf.ReadBufferCount = 1 diff --git a/rtpaac/encoder.go b/rtpaac/encoder.go index ada4848f..c6a6a862 100644 --- a/rtpaac/encoder.go +++ b/rtpaac/encoder.go @@ -44,7 +44,7 @@ func NewEncoder(relativeType uint8, config []byte) (*Encoder, error) { // Write encodes an AAC frame into RTP/AAC packets. func (e *Encoder) Write(data []byte, timestamp time.Duration) ([][]byte, error) { - if e.started == time.Duration(0) { + if e.started == 0 { e.started = timestamp } diff --git a/rtph264/encoder.go b/rtph264/encoder.go index ccde0718..41eb8215 100644 --- a/rtph264/encoder.go +++ b/rtph264/encoder.go @@ -33,7 +33,7 @@ func NewEncoder(relativeType uint8) (*Encoder, error) { // Write encodes NALUs into RTP/H264 packets. func (e *Encoder) Write(nalus [][]byte, timestamp time.Duration) ([][]byte, error) { - if e.started == time.Duration(0) { + if e.started == 0 { e.started = timestamp }