add deadline to dtls connect context (#4395)
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
package rtc
|
package rtc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"maps"
|
"maps"
|
||||||
@@ -74,6 +75,7 @@ const (
|
|||||||
negotiationFrequency = 150 * time.Millisecond
|
negotiationFrequency = 150 * time.Millisecond
|
||||||
negotiationFailedTimeout = 15 * time.Second
|
negotiationFailedTimeout = 15 * time.Second
|
||||||
dtlsRetransmissionInterval = 100 * time.Millisecond
|
dtlsRetransmissionInterval = 100 * time.Millisecond
|
||||||
|
dtlsHandshakeTimeout = time.Minute
|
||||||
|
|
||||||
iceDisconnectedTimeout = 10 * time.Second // compatible for ice-lite with firefox client
|
iceDisconnectedTimeout = 10 * time.Second // compatible for ice-lite with firefox client
|
||||||
iceFailedTimeout = 5 * time.Second // time between disconnected and failed
|
iceFailedTimeout = 5 * time.Second // time between disconnected and failed
|
||||||
@@ -387,6 +389,9 @@ func newPeerConnection(
|
|||||||
se.SetLite(false)
|
se.SetLite(false)
|
||||||
}
|
}
|
||||||
se.SetDTLSRetransmissionInterval(dtlsRetransmissionInterval)
|
se.SetDTLSRetransmissionInterval(dtlsRetransmissionInterval)
|
||||||
|
se.SetDTLSConnectContextMaker(func() (context.Context, func()) {
|
||||||
|
return context.WithTimeout(context.Background(), dtlsHandshakeTimeout)
|
||||||
|
})
|
||||||
se.SetICETimeouts(iceDisconnectedTimeout, iceFailedTimeout, iceKeepaliveInterval)
|
se.SetICETimeouts(iceDisconnectedTimeout, iceFailedTimeout, iceKeepaliveInterval)
|
||||||
|
|
||||||
// if client don't support prflx over relay, we should not expose private address to it, use single external ip as host candidate
|
// if client don't support prflx over relay, we should not expose private address to it, use single external ip as host candidate
|
||||||
|
|||||||
Reference in New Issue
Block a user