mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 23:25:33 +00:00
Added max burst setting for SCTP
This commit is contained in:
@ -46,10 +46,12 @@ RTC_EXPORT void Preload();
|
||||
RTC_EXPORT void Cleanup();
|
||||
|
||||
struct SctpSettings {
|
||||
// For the following settings, not set means optimized default
|
||||
optional<size_t> recvBufferSize;
|
||||
optional<size_t> sendBufferSize;
|
||||
optional<size_t> maxChunksOnQueue;
|
||||
optional<size_t> initialCongestionWindow;
|
||||
optional<size_t> maxBurst;
|
||||
optional<unsigned int> congestionControlModule;
|
||||
optional<std::chrono::milliseconds> delayedSackTime;
|
||||
};
|
||||
|
@ -226,6 +226,7 @@ typedef struct {
|
||||
int sendBufferSize; // <= 0 means optimized default
|
||||
int maxChunksOnQueue; // <= 0 means optimized default
|
||||
int initialCongestionWindow; // <= 0 means optimized default
|
||||
int maxBurst; // 0 means optimized default, < 0 means disabled
|
||||
int congestionControlModule; // <= 0 means default (0: RFC2581, 1: HSTCP, 2: H-TCP, 3: RTCC)
|
||||
int delayedSackTimeMs; // <= 0 means optimized default
|
||||
} rtcSctpSettings;
|
||||
|
@ -683,6 +683,11 @@ int rtcSetSctpSettings(const rtcSctpSettings *settings) {
|
||||
if (settings->initialCongestionWindow > 0)
|
||||
s.initialCongestionWindow = size_t(settings->initialCongestionWindow);
|
||||
|
||||
if (settings->maxBurst > 0)
|
||||
s.maxBurst = size_t(settings->maxBurst);
|
||||
else if (settings->maxBurst < 0)
|
||||
s.maxBurst = size_t(0); // setting to 0 disables, not setting chooses optimized default
|
||||
|
||||
if (settings->congestionControlModule >= 0)
|
||||
s.congestionControlModule = unsigned(settings->congestionControlModule);
|
||||
|
||||
|
@ -115,6 +115,9 @@ void SctpTransport::SetSettings(const SctpSettings &s) {
|
||||
// Increase initial congestion window size to 10 MTUs (RFC 6928) by default
|
||||
usrsctp_sysctl_set_sctp_initial_cwnd(to_uint32(s.initialCongestionWindow.value_or(10)));
|
||||
|
||||
// Set max burst to 10 MTUs by default (max burst is initially 0, meaning disabled)
|
||||
usrsctp_sysctl_set_sctp_max_burst_default(to_uint32(s.maxBurst.value_or(10)));
|
||||
|
||||
// Use standard SCTP congestion control (RFC 4960) by default
|
||||
// See https://github.com/paullouisageneau/libdatachannel/issues/354
|
||||
usrsctp_sysctl_set_sctp_default_cc_module(to_uint32(s.congestionControlModule.value_or(0)));
|
||||
|
Reference in New Issue
Block a user