Package io.netty.handler.codec.spdy
Class SpdySessionHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.handler.codec.spdy.SpdySessionHandler
-
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
,ChannelOutboundHandler
public class SpdySessionHandler extends ChannelDuplexHandler
Manages streams within a SPDY session.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SpdySessionHandler.ClosingChannelFutureListener
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description SpdySessionHandler(SpdyVersion version, boolean server)
Creates a new session handler.
-
Method Summary
-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
-
-
-
Field Detail
-
PROTOCOL_EXCEPTION
private static final SpdyProtocolException PROTOCOL_EXCEPTION
-
STREAM_CLOSED
private static final SpdyProtocolException STREAM_CLOSED
-
DEFAULT_WINDOW_SIZE
private static final int DEFAULT_WINDOW_SIZE
- See Also:
- Constant Field Values
-
initialSendWindowSize
private int initialSendWindowSize
-
initialReceiveWindowSize
private int initialReceiveWindowSize
-
initialSessionReceiveWindowSize
private volatile int initialSessionReceiveWindowSize
-
spdySession
private final SpdySession spdySession
-
lastGoodStreamId
private int lastGoodStreamId
-
DEFAULT_MAX_CONCURRENT_STREAMS
private static final int DEFAULT_MAX_CONCURRENT_STREAMS
- See Also:
- Constant Field Values
-
remoteConcurrentStreams
private int remoteConcurrentStreams
-
localConcurrentStreams
private int localConcurrentStreams
-
pings
private final java.util.concurrent.atomic.AtomicInteger pings
-
sentGoAwayFrame
private boolean sentGoAwayFrame
-
receivedGoAwayFrame
private boolean receivedGoAwayFrame
-
closeSessionFutureListener
private ChannelFutureListener closeSessionFutureListener
-
server
private final boolean server
-
minorVersion
private final int minorVersion
-
-
Constructor Detail
-
SpdySessionHandler
public SpdySessionHandler(SpdyVersion version, boolean server)
Creates a new session handler.- Parameters:
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.
-
-
Method Detail
-
setSessionReceiveWindowSize
public void setSessionReceiveWindowSize(int sessionReceiveWindowSize)
-
channelRead
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelRead
in interfaceChannelInboundHandler
- Overrides:
channelRead
in classChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelInactive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelInactive
in interfaceChannelInboundHandler
- Overrides:
channelInactive
in classChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireExceptionCaught(Throwable)
to forward to the nextChannelHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
exceptionCaught
in interfaceChannelHandler
- Specified by:
exceptionCaught
in interfaceChannelInboundHandler
- Overrides:
exceptionCaught
in classChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
close
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
Description copied from class:ChannelDuplexHandler
CallsChannelOutboundInvoker.close(ChannelPromise)
to forward to the nextChannelOutboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
close
in interfaceChannelOutboundHandler
- Overrides:
close
in classChannelDuplexHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the close operation is madepromise
- theChannelPromise
to notify once the operation completes- Throws:
java.lang.Exception
- thrown if an error occurs
-
write
public void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
Description copied from class:ChannelDuplexHandler
CallsChannelOutboundInvoker.write(Object, ChannelPromise)
to forward to the nextChannelOutboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
write
in interfaceChannelOutboundHandler
- Overrides:
write
in classChannelDuplexHandler
- Parameters:
ctx
- theChannelHandlerContext
for which the write operation is mademsg
- the message to writepromise
- theChannelPromise
to notify once the operation completes- Throws:
java.lang.Exception
- thrown if an error occurs
-
handleOutboundMessage
private void handleOutboundMessage(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
- Throws:
java.lang.Exception
-
issueSessionError
private void issueSessionError(ChannelHandlerContext ctx, SpdySessionStatus status)
-
issueStreamError
private void issueStreamError(ChannelHandlerContext ctx, int streamId, SpdyStreamStatus status)
-
isRemoteInitiatedId
private boolean isRemoteInitiatedId(int id)
-
updateInitialSendWindowSize
private void updateInitialSendWindowSize(int newInitialWindowSize)
-
updateInitialReceiveWindowSize
private void updateInitialReceiveWindowSize(int newInitialWindowSize)
-
acceptStream
private boolean acceptStream(int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed)
-
halfCloseStream
private void halfCloseStream(int streamId, boolean remote, ChannelFuture future)
-
removeStream
private void removeStream(int streamId, ChannelFuture future)
-
updateSendWindowSize
private void updateSendWindowSize(ChannelHandlerContext ctx, int streamId, int deltaWindowSize)
-
sendGoAwayFrame
private void sendGoAwayFrame(ChannelHandlerContext ctx, ChannelPromise future)
-
sendGoAwayFrame
private ChannelFuture sendGoAwayFrame(ChannelHandlerContext ctx, SpdySessionStatus status)
-
-