Przeglądaj źródła

Increase the initial window size to 10 MTUs

Paul-Louis Ageneau 5 lat temu
rodzic
commit
fc29073577
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      src/sctptransport.cpp

+ 6 - 3
src/sctptransport.cpp

@@ -64,6 +64,9 @@ void SctpTransport::Init() {
 
 	// Change congestion control from the default TCP Reno (RFC 2581) to HighSpeed TCP (RFC 3649)
 	usrsctp_sysctl_set_sctp_default_cc_module(SCTP_CC_HSTCP);
+
+	// Increase the initial window size to 10 MTUs (RFC 6928)
+	usrsctp_sysctl_set_sctp_initial_cwnd(10);
 }
 
 void SctpTransport::Cleanup() {
@@ -161,11 +164,11 @@ SctpTransport::SctpTransport(std::shared_ptr<Transport> lower, uint16_t port,
 	// The default send and receive window size of usrsctp is 256KiB, which is too small for
 	// realistic RTTs, therefore we increase it to 1MiB for better performance.
 	// See https://bugzilla.mozilla.org/show_bug.cgi?id=1051685
-	int bufSize = 1024 * 1024;
-	if (usrsctp_setsockopt(mSock, SOL_SOCKET, SO_RCVBUF, &bufSize, sizeof(bufSize)))
+	int bufferSize = 1024 * 1024;
+	if (usrsctp_setsockopt(mSock, SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)))
 		throw std::runtime_error("Could not set SCTP recv buffer size, errno=" +
 		                         std::to_string(errno));
-	if (usrsctp_setsockopt(mSock, SOL_SOCKET, SO_SNDBUF, &bufSize, sizeof(bufSize)))
+	if (usrsctp_setsockopt(mSock, SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)))
 		throw std::runtime_error("Could not set SCTP send buffer size, errno=" +
 		                         std::to_string(errno));