public class SpdySessionHandler extends ChannelDuplexHandler
Modifier and Type | Class and Description |
---|---|
private static class |
SpdySessionHandler.ClosingChannelFutureListener |
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
private ChannelFutureListener |
closeSessionFutureListener |
private static int |
DEFAULT_MAX_CONCURRENT_STREAMS |
private static int |
DEFAULT_WINDOW_SIZE |
private int |
initialReceiveWindowSize |
private int |
initialSendWindowSize |
private int |
initialSessionReceiveWindowSize |
private int |
lastGoodStreamId |
private int |
localConcurrentStreams |
private int |
minorVersion |
private java.util.concurrent.atomic.AtomicInteger |
pings |
private static SpdyProtocolException |
PROTOCOL_EXCEPTION |
private boolean |
receivedGoAwayFrame |
private int |
remoteConcurrentStreams |
private boolean |
sentGoAwayFrame |
private boolean |
server |
private SpdySession |
spdySession |
private static SpdyProtocolException |
STREAM_CLOSED |
Constructor and Description |
---|
SpdySessionHandler(SpdyVersion version,
boolean server)
Creates a new session handler.
|
bind, connect, deregister, disconnect, flush, read
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded, handlerRemoved
private static final SpdyProtocolException PROTOCOL_EXCEPTION
private static final SpdyProtocolException STREAM_CLOSED
private static final int DEFAULT_WINDOW_SIZE
private int initialSendWindowSize
private int initialReceiveWindowSize
private volatile int initialSessionReceiveWindowSize
private final SpdySession spdySession
private int lastGoodStreamId
private static final int DEFAULT_MAX_CONCURRENT_STREAMS
private int remoteConcurrentStreams
private int localConcurrentStreams
private final java.util.concurrent.atomic.AtomicInteger pings
private boolean sentGoAwayFrame
private boolean receivedGoAwayFrame
private ChannelFutureListener closeSessionFutureListener
private final boolean server
private final int minorVersion
public SpdySessionHandler(SpdyVersion version, boolean server)
version
- the protocol versionserver
- true
if and only if this session handler should
handle the server endpoint of the connection.
false
if and only if this session handler should
handle the client endpoint of the connection.public void setSessionReceiveWindowSize(int sessionReceiveWindowSize)
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelRead(Object)
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelRead
in interface ChannelInboundHandler
channelRead
in class ChannelInboundHandlerAdapter
java.lang.Exception
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelInactive()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelInactive
in interface ChannelInboundHandler
channelInactive
in class ChannelInboundHandlerAdapter
java.lang.Exception
public void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireExceptionCaught(Throwable)
to forward
to the next ChannelHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.exceptionCaught
in interface ChannelHandler
exceptionCaught
in interface ChannelInboundHandler
exceptionCaught
in class ChannelInboundHandlerAdapter
java.lang.Exception
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelHandlerContext.close(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.close
in interface ChannelOutboundHandler
close
in class ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the close operation is madepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error accourpublic void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelHandlerContext.write(Object, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.write
in interface ChannelOutboundHandler
write
in class ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the write operation is mademsg
- the message to writepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error accourprivate void handleOutboundMessage(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
java.lang.Exception
private void issueSessionError(ChannelHandlerContext ctx, SpdySessionStatus status)
private void issueStreamError(ChannelHandlerContext ctx, int streamId, SpdyStreamStatus status)
private boolean isRemoteInitiatedId(int id)
private void updateInitialSendWindowSize(int newInitialWindowSize)
private void updateInitialReceiveWindowSize(int newInitialWindowSize)
private boolean acceptStream(int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed)
private void halfCloseStream(int streamId, boolean remote, ChannelFuture future)
private void removeStream(int streamId, ChannelFuture future)
private void updateSendWindowSize(ChannelHandlerContext ctx, int streamId, int deltaWindowSize)
private void sendGoAwayFrame(ChannelHandlerContext ctx, ChannelPromise future)
private ChannelFuture sendGoAwayFrame(ChannelHandlerContext ctx, SpdySessionStatus status)