Skip to content

Commit c5d629f

Browse files
committed
Add methods for tweaking sctp cc to settingending
Relate: pion/sctp#354
1 parent 6fd1344 commit c5d629f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

sctptransport.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ func (r *SCTPTransport) Start(capabilities SCTPCapabilities) error {
121121
BlockWrite: r.api.settingEngine.detach.DataChannels && r.api.settingEngine.dataChannelBlockWrite,
122122
MaxMessageSize: maxMessageSize,
123123
MTU: outboundMTU,
124+
MinCwnd: r.api.settingEngine.sctp.minCwnd,
125+
FastRtxWnd: r.api.settingEngine.sctp.fastRtxWnd,
126+
CwndCAStep: r.api.settingEngine.sctp.cwndCAStep,
124127
})
125128
if err != nil {
126129
return err

settingengine.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ type SettingEngine struct {
8484
enableZeroChecksum bool
8585
rtoMax time.Duration
8686
maxMessageSize uint32
87+
minCwnd uint32
88+
fastRtxWnd uint32
89+
cwndCAStep uint32
8790
}
8891
sdpMediaLevelFingerprints bool
8992
answeringDTLSRole DTLSRole
@@ -525,6 +528,22 @@ func (e *SettingEngine) SetSCTPRTOMax(rtoMax time.Duration) {
525528
e.sctp.rtoMax = rtoMax
526529
}
527530

531+
// SetSCTPMinCwnd sets the minimum congestion window size. The congestion window
532+
// will not be smaller than this value during congestion control.
533+
func (e *SettingEngine) SetSCTPMinCwnd(minCwnd uint32) {
534+
e.sctp.minCwnd = minCwnd
535+
}
536+
537+
// SetSCTPFastRtxWnd sets the fast retransmission window size.
538+
func (e *SettingEngine) SetSCTPFastRtxWnd(fastRtxWnd uint32) {
539+
e.sctp.fastRtxWnd = fastRtxWnd
540+
}
541+
542+
// SetSCTPCwndCAStep sets congestion window adjustment step size during congestion avoidance.
543+
func (e *SettingEngine) SetSCTPCwndCAStep(cwndCAStep uint32) {
544+
e.sctp.cwndCAStep = cwndCAStep
545+
}
546+
528547
// SetICEBindingRequestHandler sets a callback that is fired on a STUN BindingRequest
529548
// This allows users to do things like
530549
// - Log incoming Binding Requests for debugging

0 commit comments

Comments
 (0)