From 15099af48064c22bc3357b01c9efcb1aa43c4819 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 1 Feb 2014 12:52:12 -0800 Subject: [PATCH] Flush control frames; don't flush user frames. --- .../com/squareup/okhttp/internal/spdy/Http20Draft09.java | 5 +++++ .../main/java/com/squareup/okhttp/internal/spdy/Spdy3.java | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java index fd465f9c8b1a..307a4a52b6f6 100644 --- a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java +++ b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java @@ -317,6 +317,7 @@ static final class Writer implements FrameWriter { @Override public synchronized void connectionHeader() throws IOException { if (!client) return; // Nothing to write; servers don't send connection headers! out.write(CONNECTION_HEADER); + out.flush(); } @Override @@ -409,6 +410,7 @@ void dataFrame(int streamId, byte flags, byte[] data, int offset, int length) out.writeInt(i & 0xffffff); out.writeInt(settings.get(i)); } + out.flush(); } @Override public synchronized void ping(boolean ack, int payload1, int payload2) @@ -420,6 +422,7 @@ void dataFrame(int streamId, byte flags, byte[] data, int offset, int length) frameHeader(length, type, flags, streamId); out.writeInt(payload1); out.writeInt(payload2); + out.flush(); } @Override @@ -436,6 +439,7 @@ public synchronized void goAway(int lastGoodStreamId, ErrorCode errorCode, byte[ if (debugData.length > 0) { out.write(debugData); } + out.flush(); } @Override public synchronized void windowUpdate(int streamId, long windowSizeIncrement) @@ -449,6 +453,7 @@ public synchronized void goAway(int lastGoodStreamId, ErrorCode errorCode, byte[ byte flags = FLAG_NONE; frameHeader(length, type, flags, streamId); out.writeInt((int) windowSizeIncrement); + out.flush(); } @Override public void close() throws IOException { diff --git a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Spdy3.java b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Spdy3.java index 393b6ee00217..75060445aea0 100644 --- a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Spdy3.java +++ b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Spdy3.java @@ -369,7 +369,6 @@ public synchronized void synStream(boolean outFinished, boolean inFinished, int out.writeInt((flags & 0xff) << 24 | length & 0xffffff); out.writeInt(streamId & 0x7fffffff); headerBlockBuffer.writeTo(out); - out.flush(); } @Override public synchronized void rstStream(int streamId, ErrorCode errorCode)