[#1210] Allow to use derived buffers with DefaultBufferHolder and so fix broken SpdySessionHandler

This commit is contained in:
Norman Maurer 2013-03-27 07:30:12 +01:00
parent f53db96a3e
commit 71727e42de
2 changed files with 3 additions and 7 deletions

View File

@ -27,10 +27,6 @@ public class DefaultByteBufHolder implements ByteBufHolder {
if (data == null) {
throw new NullPointerException("data");
}
if (data.unwrap() != null && !(data instanceof SwappedByteBuf)) {
throw new IllegalArgumentException("Only not-derived ByteBuf instance are supported, you used: "
+ data.getClass().getSimpleName());
}
this.data = data;
}

View File

@ -208,7 +208,7 @@ public class SpdySessionHandler
if (newWindowSize < 0) {
while (spdyDataFrame.data().readableBytes() > initialReceiveWindowSize) {
SpdyDataFrame partialDataFrame = new DefaultSpdyDataFrame(streamID,
spdyDataFrame.data().readSlice(initialReceiveWindowSize));
spdyDataFrame.data().readSlice(initialReceiveWindowSize).retain());
ctx.nextOutboundMessageBuffer().add(partialDataFrame);
ctx.flush();
}
@ -525,7 +525,7 @@ public class SpdySessionHandler
// Create a partial data frame whose length is the current window size
SpdyDataFrame partialDataFrame = new DefaultSpdyDataFrame(streamID,
spdyDataFrame.data().readSlice(sendWindowSize));
spdyDataFrame.data().readSlice(sendWindowSize).retain());
// Enqueue the remaining data (will be the first frame queued)
spdySession.putPendingWrite(streamID, spdyDataFrame);
@ -849,7 +849,7 @@ public class SpdySessionHandler
// Create a partial data frame whose length is the current window size
SpdyDataFrame partialDataFrame = new DefaultSpdyDataFrame(streamID,
spdyDataFrame.data().readSlice(newWindowSize));
spdyDataFrame.data().readSlice(newWindowSize).retain());
// The transfer window size is pre-decremented when sending a data frame downstream.
// Close the stream on write failures that leaves the transfer window in a corrupt state.