SPDY: fix bug #1211 reintroduced in 7bedd8f

This commit is contained in:
Jeff Pinner 2013-07-11 13:54:49 -07:00 committed by Norman Maurer
parent 64686deaff
commit daa79f3a11

View File

@ -417,7 +417,8 @@ public class SpdySessionHandler
// Frames must not be sent on half-closed streams // Frames must not be sent on half-closed streams
if (spdySession.isLocalSideClosed(streamId)) { if (spdySession.isLocalSideClosed(streamId)) {
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} }
/* /*
@ -506,14 +507,16 @@ public class SpdySessionHandler
int streamId = spdySynStreamFrame.getStreamId(); int streamId = spdySynStreamFrame.getStreamId();
if (isRemoteInitiatedID(streamId)) { if (isRemoteInitiatedID(streamId)) {
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} }
byte priority = spdySynStreamFrame.getPriority(); byte priority = spdySynStreamFrame.getPriority();
boolean remoteSideClosed = spdySynStreamFrame.isUnidirectional(); boolean remoteSideClosed = spdySynStreamFrame.isUnidirectional();
boolean localSideClosed = spdySynStreamFrame.isLast(); boolean localSideClosed = spdySynStreamFrame.isLast();
if (!acceptStream(streamId, priority, remoteSideClosed, localSideClosed)) { if (!acceptStream(streamId, priority, remoteSideClosed, localSideClosed)) {
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} }
} else if (msg instanceof SpdySynReplyFrame) { } else if (msg instanceof SpdySynReplyFrame) {
@ -523,7 +526,8 @@ public class SpdySessionHandler
// Frames must not be sent on half-closed streams // Frames must not be sent on half-closed streams
if (!isRemoteInitiatedID(streamId) || spdySession.isLocalSideClosed(streamId)) { if (!isRemoteInitiatedID(streamId) || spdySession.isLocalSideClosed(streamId)) {
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} }
// Close the local side of the stream if this is the last frame // Close the local side of the stream if this is the last frame
@ -576,7 +580,8 @@ public class SpdySessionHandler
// Why is this being sent? Intercept it and fail the write. // Why is this being sent? Intercept it and fail the write.
// Should have sent a CLOSE ChannelStateEvent // Should have sent a CLOSE ChannelStateEvent
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} else if (msg instanceof SpdyHeadersFrame) { } else if (msg instanceof SpdyHeadersFrame) {
@ -585,7 +590,8 @@ public class SpdySessionHandler
// Frames must not be sent on half-closed streams // Frames must not be sent on half-closed streams
if (spdySession.isLocalSideClosed(streamId)) { if (spdySession.isLocalSideClosed(streamId)) {
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} }
// Close the local side of the stream if this is the last frame // Close the local side of the stream if this is the last frame
@ -596,7 +602,8 @@ public class SpdySessionHandler
} else if (msg instanceof SpdyWindowUpdateFrame) { } else if (msg instanceof SpdyWindowUpdateFrame) {
// Why is this being sent? Intercept it and fail the write. // Why is this being sent? Intercept it and fail the write.
throw PROTOCOL_EXCEPTION; promise.setFailure(PROTOCOL_EXCEPTION);
return;
} }
ctx.write(msg, promise); ctx.write(msg, promise);