Bug 1562315 - Respect again=false indicated by http2 session when calling through TLSFilterTransaction, r=dragana
authorHonza Bambas <honzab.moz@firemni.cz>
Mon, 01 Jul 2019 14:26:34 +0000
changeset 540447 3eea5e6ac99ea5b13dd7435ddab7ac6af5d3ac72
parent 540446 2ddfd4fe0ab5da09569c49bb53154c4795e19e7a
child 540448 7f91c3a8a9eefbae051e5ab0048e1f3b5793a573
push id11529
push userarchaeopteryx@coole-files.de
push dateThu, 04 Jul 2019 15:22:33 +0000
treeherdermozilla-beta@ebb510a784b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1562315
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1562315 - Respect again=false indicated by http2 session when calling through TLSFilterTransaction, r=dragana Differential Revision: https://phabricator.services.mozilla.com/D36384
netwerk/protocol/http/TunnelUtils.cpp
netwerk/protocol/http/TunnelUtils.h
--- a/netwerk/protocol/http/TunnelUtils.cpp
+++ b/netwerk/protocol/http/TunnelUtils.cpp
@@ -351,41 +351,50 @@ nsresult TLSFilterTransaction::ReadSegme
     LOG(("TLSFilterTransaction %p read segment blocked found rv=%" PRIx32 "\n",
          this, static_cast<uint32_t>(rv)));
     Unused << Connection()->ForceSend();
   }
 
   return NS_SUCCEEDED(rv) ? mReadSegmentReturnValue : rv;
 }
 
-nsresult TLSFilterTransaction::WriteSegments(nsAHttpSegmentWriter* aWriter,
-                                             uint32_t aCount,
-                                             uint32_t* outCountWritten) {
+nsresult TLSFilterTransaction::WriteSegmentsAgain(nsAHttpSegmentWriter* aWriter,
+                                                  uint32_t aCount,
+                                                  uint32_t* outCountWritten,
+                                                  bool* again) {
   MOZ_ASSERT(OnSocketThread(), "not on socket thread");
-  LOG(("TLSFilterTransaction::WriteSegments %p max=%d\n", this, aCount));
+  LOG(("TLSFilterTransaction::WriteSegmentsAgain %p max=%d\n", this, aCount));
 
   if (!mTransaction) {
     return NS_ERROR_UNEXPECTED;
   }
 
   mSegmentWriter = aWriter;
-  nsresult rv = mTransaction->WriteSegments(this, aCount, outCountWritten);
+  nsresult rv =
+      mTransaction->WriteSegmentsAgain(this, aCount, outCountWritten, again);
   if (NS_SUCCEEDED(rv) && NS_FAILED(mFilterReadCode) && !(*outCountWritten)) {
     // nsPipe turns failures into silent OK.. undo that!
     rv = mFilterReadCode;
     if (Connection() && (mFilterReadCode == NS_BASE_STREAM_WOULD_BLOCK)) {
       Unused << Connection()->ResumeRecv();
     }
   }
   LOG(("TLSFilterTransaction %p called trans->WriteSegments rv=%" PRIx32
        " %d\n",
        this, static_cast<uint32_t>(rv), *outCountWritten));
   return rv;
 }
 
+nsresult TLSFilterTransaction::WriteSegments(nsAHttpSegmentWriter* aWriter,
+                                             uint32_t aCount,
+                                             uint32_t* outCountWritten) {
+  bool again = false;
+  return WriteSegmentsAgain(aWriter, aCount, outCountWritten, &again);
+}
+
 nsresult TLSFilterTransaction::GetTransactionSecurityInfo(
     nsISupports** outSecInfo) {
   if (!mSecInfo) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsISupports> temp(mSecInfo);
   temp.forget(outSecInfo);
--- a/netwerk/protocol/http/TunnelUtils.h
+++ b/netwerk/protocol/http/TunnelUtils.h
@@ -139,16 +139,20 @@ class TLSFilterTransaction final : publi
                    nsIAsyncInputStream** outSocketIn,
                    nsIAsyncOutputStream** outSocketOut);
 
   // nsAHttpTransaction overloads
   bool IsNullTransaction() override;
   NullHttpTransaction* QueryNullTransaction() override;
   nsHttpTransaction* QueryHttpTransaction() override;
   SpdyConnectTransaction* QuerySpdyConnectTransaction() override;
+  MOZ_MUST_USE nsresult WriteSegmentsAgain(nsAHttpSegmentWriter* writer,
+                                           uint32_t count,
+                                           uint32_t* countWritten,
+                                           bool* again) override;
 
  private:
   MOZ_MUST_USE nsresult StartTimerCallback();
   void Cleanup();
   int32_t FilterOutput(const char* aBuf, int32_t aAmount);
   int32_t FilterInput(char* aBuf, int32_t aAmount);
 
   static PRStatus GetPeerName(PRFileDesc* fd, PRNetAddr* addr);