< prev index next >

src/java.httpclient/share/classes/java/net/http/Stream.java

Print this page
rev 14972 : fix flow controller
rev 14971 : cumulative window update
rev 14882 : 8158980: Memory leak in HTTP2Connection.streams
Reviewed-by: chegar
rev 14682 : 8158651: ConcurrentModification exceptions in httpclient
Reviewed-by: rriggs
rev 14584 : 8157105: HTTP/2 client hangs in blocking mode if an invalid frame has been received
Reviewed-by: rriggs
rev 14431 : 8156710: HttpTimeoutException should be thrown if server doesn't respond
Reviewed-by: michaelm
rev 14348 : 8087124: HTTP/2 implementation
Reviewed-by: chegar
rev 13785 : 8087112: HTTP API and HTTP/1.1 implementation
Reviewed-by: alanb, chegar, coffeys, psandoz, rriggs

@@ -464,17 +464,17 @@
             take(1);
         }
 
         public synchronized void take(int amount) throws InterruptedException {
             assert permits >= 0;
-            while (permits < amount) {
+            do {
                 int n = Math.min(amount, permits);
                 permits -= n;
                 amount -= n;
                 if (amount > 0)
                     wait();
-            }
+            } while (permits < amount);
         }
     }
 
     @Override
     void sendHeadersOnly() throws IOException, InterruptedException {

@@ -496,11 +496,11 @@
         connection.putStream(this, streamid);
     }
 
     DataFrame getDataFrame() throws IOException, InterruptedException {
         userRequestFlowController.take();
-        int maxpayloadLen = connection.getMaxSendFrameSize() - 9;
+        int maxpayloadLen = connection.getMaxSendFrameSize();
         ByteBuffer buffer = connection.getBuffer();
         buffer.limit(maxpayloadLen);
         boolean complete = requestProcessor.onRequestBodyChunk(buffer);
         buffer.flip();
         int amount = buffer.remaining();
< prev index next >