Skip to content

Commit

Permalink
Flush control frames; don't flush user frames.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Cole committed Feb 1, 2014
1 parent f2ef66f commit 15099af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 15099af

Please sign in to comment.