Bug 1426831: don't overwrite MaxMessageSize with default values. draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Tue, 09 Jan 2018 17:30:19 -0800 (2018-01-10)
changeset 747355 2c48168019c883944a4e9b2816187e487ae20c5e
parent 747282 7921dcc2bf6bd1ab5ca58e763caefc29ba0e9f35
push id96888
push userdrno@ohlmeier.org
push dateThu, 25 Jan 2018 22:55:35 +0000 (2018-01-25)
bugs1426831
milestone60.0a1
Bug 1426831: don't overwrite MaxMessageSize with default values. MozReview-Commit-ID: CiqoGUYbPR2
netwerk/sctp/datachannel/DataChannel.cpp
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -431,16 +431,17 @@ DataChannelConnection::Init(unsigned sho
                             SCTP_STREAM_RESET_EVENT,
                             SCTP_STREAM_CHANGE_EVENT};
   {
     ASSERT_WEBRTC(NS_IsMainThread());
     // MutexAutoLock lock(mLock); Not needed since we're on mainthread always
 
     mSendInterleaved = false;
     mPpidFragmentation = false;
+    mMaxMessageSizeSet = false;
     SetMaxMessageSize(aMaxMessageSizeSet, aMaxMessageSize);
 
     if (!sctp_initialized) {
       LOG(("sctp_init"));
 #ifdef MOZ_PEERCONNECTION
       usrsctp_init(0,
                    DataChannelConnection::SctpDtlsOutput,
                    debug_printf
@@ -596,16 +597,21 @@ error_cleanup:
   return false;
 }
 
 void
 DataChannelConnection::SetMaxMessageSize(bool aMaxMessageSizeSet, uint64_t aMaxMessageSize)
 {
   MutexAutoLock lock(mLock); // TODO: Needed?
 
+  if (mMaxMessageSizeSet && !aMaxMessageSizeSet) {
+    // Don't overwrite already set MMS with default values
+    return;
+  }
+
   mMaxMessageSizeSet = aMaxMessageSizeSet;
   mMaxMessageSize = aMaxMessageSize;
 
   bool ppidFragmentationEnforced = false;
   nsresult rv;
   nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
   if (!NS_WARN_IF(NS_FAILED(rv))) {
     nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);