Commit 937483ad authored by Andrew Creskey's avatar Andrew Creskey
Browse files

Bug 1830918 - Provide a mechanism to disable the forcing of the tcp send...

Bug 1830918 - Provide a mechanism to disable the forcing of the tcp send buffer size on http/2 uploads r=necko-reviewers,valentin

In Bug 1596576 we will disable by default the forcing of tcp send buffer sizes on http/2 uploads.
This provides a mechanism for users to test early.

Differential Revision: https://phabricator.services.mozilla.com/D176927
parent c1dee1eb
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -554,19 +554,25 @@ void Http2StreamBase::UpdateTransportReadEvents(uint32_t count) {
void Http2StreamBase::UpdateTransportSendEvents(uint32_t count) {
  mTotalSent += count;

  // Setting the TCP send buffer, introduced in
  // https://bugzilla.mozilla.org/show_bug.cgi?id=790184, which the following
  // comment refers to, is being removed once we verify no increases in error
  // rates.
  //
  // normally on non-windows platform we use TCP autotuning for
  // the socket buffers, and this works well (managing enough
  // buffers for BDP while conserving memory) for HTTP even when
  // it creates really deep queues. However this 'buffer bloat' is
  // a problem for http/2 because it ruins the low latency properties
  // necessary for PING and cancel to work meaningfully.
  //

  // If this stream represents a large upload, disable autotuning for
  // the session and cap the send buffers by default at 128KB.
  // (10Mbit/sec @ 100ms)
  //
  uint32_t bufferSize = gHttpHandler->SpdySendBufferSize();
  if ((mTotalSent > bufferSize) && !mSetTCPSocketBuffer) {
  if (StaticPrefs::network_http_http2_send_buffer_size() > 0 &&
      (mTotalSent > bufferSize) && !mSetTCPSocketBuffer) {
    mSetTCPSocketBuffer = 1;
    mSocketTransport->SetSendBufferSize(bufferSize);
  }
+2 −2
Original line number Diff line number Diff line
@@ -1388,8 +1388,8 @@ void nsHttpHandler::PrefsChanged(const char* pref) {
        1));
  }

  // The amount of seconds to wait for a http2 ping response before
  // closing the session.
  // If http2.send-buffer-size is non-zero, the size to set the TCP
  //  sendbuffer to once the stream has surpassed this number of bytes uploaded
  if (PREF_CHANGED(HTTP_PREF("http2.send-buffer-size"))) {
    mSpdySendBufferSize = (uint32_t)clamped(
        StaticPrefs::network_http_http2_send_buffer_size(), 1500, 0x7fffffff);