Skip to content

Commit

Permalink
reset write & read deadline in voice conn open
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Apr 29, 2023
1 parent 57b63ff commit ccbf79c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions voice/udp_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ func (u *udpConnImpl) Open(ctx context.Context, ip string, port int, ssrc uint32
if err = u.conn.SetWriteDeadline(time.Now().Add(5 * time.Second)); err != nil {
return "", 0, fmt.Errorf("failed to set write deadline on UDPConn connection: %w", err)
}
defer func() {
_ = u.conn.SetWriteDeadline(time.Time{})
}()
if _, err = u.conn.Write(sb); err != nil {
return "", 0, fmt.Errorf("failed to write ssrc to UDPConn connection: %w", err)
}
Expand All @@ -172,6 +175,9 @@ func (u *udpConnImpl) Open(ctx context.Context, ip string, port int, ssrc uint32
if err = u.conn.SetReadDeadline(time.Now().Add(5 * time.Second)); err != nil {
return "", 0, fmt.Errorf("failed to set read deadline on UDPConn connection: %w", err)
}
defer func() {
_ = u.conn.SetReadDeadline(time.Time{})
}()
if _, err = u.conn.Read(rb); err != nil {
return "", 0, fmt.Errorf("failed to read ip discovery from UDPConn connection: %w", err)
}
Expand Down

0 comments on commit ccbf79c

Please sign in to comment.