File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,10 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error {
327327 dtlsConfig .ReplayProtectionWindow = int (* t .api .settingEngine .replayProtection .DTLS )
328328 }
329329
330+ if t .api .settingEngine .dtls .retransmissionInterval != 0 {
331+ dtlsConfig .FlightInterval = t .api .settingEngine .dtls .retransmissionInterval
332+ }
333+
330334 // Connect as DTLS Client/Server, function is blocking and we
331335 // must not hold the DTLSTransport lock
332336 if role == DTLSRoleClient {
Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ type SettingEngine struct {
5151 SRTP * uint
5252 SRTCP * uint
5353 }
54+ dtls struct {
55+ retransmissionInterval time.Duration
56+ }
5457 sdpMediaLevelFingerprints bool
5558 answeringDTLSRole DTLSRole
5659 disableCertificateFingerprintVerification bool
@@ -296,3 +299,8 @@ func (e *SettingEngine) DisableMediaEngineCopy(isDisabled bool) {
296299func (e * SettingEngine ) SetReceiveMTU (receiveMTU uint ) {
297300 e .receiveMTU = receiveMTU
298301}
302+
303+ // SetDTLSRetransmissionInterval sets the retranmission interval for DTLS.
304+ func (e * SettingEngine ) SetDTLSRetransmissionInterval (interval time.Duration ) {
305+ e .dtls .retransmissionInterval = interval
306+ }
Original file line number Diff line number Diff line change @@ -213,3 +213,23 @@ func TestSettingEngine_SetDisableMediaEngineCopy(t *testing.T) {
213213 closePairNow (t , offerer , answerer )
214214 })
215215}
216+
217+ func TestSetDTLSRetransmissionInterval (t * testing.T ) {
218+ s := SettingEngine {}
219+
220+ if s .dtls .retransmissionInterval != 0 {
221+ t .Fatalf ("SettingEngine defaults aren't as expected." )
222+ }
223+
224+ s .SetDTLSRetransmissionInterval (100 * time .Millisecond )
225+ if s .dtls .retransmissionInterval == 0 ||
226+ s .dtls .retransmissionInterval != 100 * time .Millisecond {
227+ t .Errorf ("Failed to set DTLS retransmission interval" )
228+ }
229+
230+ s .SetDTLSRetransmissionInterval (1 * time .Second )
231+ if s .dtls .retransmissionInterval == 0 ||
232+ s .dtls .retransmissionInterval != 1 * time .Second {
233+ t .Errorf ("Failed to set DTLS retransmission interval" )
234+ }
235+ }
You can’t perform that action at this time.
0 commit comments