RTMP client: fix timeout when publishing

This commit is contained in:
aler9 2021-04-05 13:23:53 +02:00
parent 28de7aefa2
commit 71c333177f
1 changed files with 8 additions and 1 deletions

View File

@ -169,7 +169,8 @@ func (c *Client) run() {
defer onConnectCmd.Close()
}
c.conn.NetConn().SetDeadline(time.Now().Add(c.readTimeout))
c.conn.NetConn().SetReadDeadline(time.Now().Add(c.readTimeout))
c.conn.NetConn().SetWriteDeadline(time.Now().Add(c.writeTimeout))
err := c.conn.ServerHandshake()
if err != nil {
c.log(logger.Info, "ERR: %s", err)
@ -303,6 +304,9 @@ func (c *Client) runRead() {
return
}
// disable read deadline
c.conn.NetConn().SetReadDeadline(time.Time{})
writerDone := make(chan error)
go func() {
writerDone <- func() error {
@ -471,6 +475,9 @@ func (c *Client) runPublish() {
return
}
// disable write deadline
c.conn.NetConn().SetWriteDeadline(time.Time{})
readerDone := make(chan error)
go func() {
readerDone <- func() error {