Http2Session

abstract
class Http2Session : SessionSPI , Listener {}

Constructors

this
this(Scheduler scheduler, Connection endPoint, Http2Generator generator, StreamSession.Listener listener, FlowControlStrategy flowControl, int initialStreamId, int streamIdleTimeout)
Undocumented in source.

Members

Aliases

convertToMillisecond
alias convertToMillisecond = convert!(TimeUnit.HectoNanosecond, TimeUnit.Millisecond)
Undocumented in source.

Functions

abort
void abort(Exception failure)
Undocumented in source. Be warned that the author may not have intended to support it.
close
bool close(int error, string reason, Callback callback)

Invoked internally and by applications to send a GO_AWAY frame to the other peer. We check the close state to act appropriately: <ul> <li>NOT_CLOSED: we move to LOCALLY_CLOSED and queue a GO_AWAY. When the GO_AWAY has been written, it will only cause the output to be shut down (not the connection closed), so that the application can still read frames arriving from the other peer. Ideally the other peer will notice the GO_AWAY and close the connection. When that happen, we close the connection from {@link #onShutdown()}. Otherwise, the idle timeout mechanism will close the connection, see {@link #onIdleTimeout()}.</li> <li>In all other cases, we do nothing since other methods are already performing their actions.</li> </ul>

createLocalStream
StreamSPI createLocalStream(int streamId, Promise!Stream promise)
Undocumented in source. Be warned that the author may not have intended to support it.
createRemoteStream
StreamSPI createRemoteStream(int streamId)
Undocumented in source. Be warned that the author may not have intended to support it.
data
void data(StreamSPI stream, Callback callback, DataFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
disconnect
void disconnect()
Undocumented in source. Be warned that the author may not have intended to support it.
frames
void frames(StreamSPI stream, Callback callback, Frame frame, Frame[] frames)
Undocumented in source. Be warned that the author may not have intended to support it.
getBytesWritten
long getBytesWritten()
Undocumented in source. Be warned that the author may not have intended to support it.
getEndPoint
Connection getEndPoint()
Undocumented in source. Be warned that the author may not have intended to support it.
getFlowControlStrategy
FlowControlStrategy getFlowControlStrategy()
Undocumented in source. Be warned that the author may not have intended to support it.
getGenerator
Http2Generator getGenerator()
Undocumented in source. Be warned that the author may not have intended to support it.
getInitialSessionRecvWindow
int getInitialSessionRecvWindow()
Undocumented in source. Be warned that the author may not have intended to support it.
getMaxLocalStreams
int getMaxLocalStreams()
Undocumented in source. Be warned that the author may not have intended to support it.
getMaxRemoteStreams
int getMaxRemoteStreams()
Undocumented in source. Be warned that the author may not have intended to support it.
getRecvWindow
int getRecvWindow()
Undocumented in source. Be warned that the author may not have intended to support it.
getSendWindow
int getSendWindow()
Undocumented in source. Be warned that the author may not have intended to support it.
getStream
StreamSPI getStream(int streamId)
Undocumented in source. Be warned that the author may not have intended to support it.
getStreamCount
int getStreamCount()
Undocumented in source. Be warned that the author may not have intended to support it.
getStreamIdleTimeout
long getStreamIdleTimeout()
Undocumented in source. Be warned that the author may not have intended to support it.
getStreams
Stream[] getStreams()
Undocumented in source. Be warned that the author may not have intended to support it.
isClosed
bool isClosed()
Undocumented in source. Be warned that the author may not have intended to support it.
isDisconnected
bool isDisconnected()
Undocumented in source. Be warned that the author may not have intended to support it.
isPushEnabled
bool isPushEnabled()
Undocumented in source. Be warned that the author may not have intended to support it.
newStream
void newStream(HeadersFrame frame, Promise!Stream promise, Stream.Listener listener)
Undocumented in source. Be warned that the author may not have intended to support it.
newStream
StreamSPI newStream(int streamId, bool local)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyClose
void notifyClose(StreamSession session, GoAwayFrame frame, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyFailure
void notifyFailure(StreamSession session, Exception failure, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyHeaders
void notifyHeaders(StreamSPI stream, HeadersFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyIdleTimeout
bool notifyIdleTimeout(StreamSession session)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyNewStream
Stream.Listener notifyNewStream(Stream stream, HeadersFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyPing
void notifyPing(StreamSession session, PingFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
notifyReset
void notifyReset(StreamSession session, ResetFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
notifySettings
void notifySettings(StreamSession session, SettingsFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onConnectionFailure
void onConnectionFailure(int error, string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
onData
void onData(DataFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onFrame
void onFrame(Frame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onGoAway
void onGoAway(GoAwayFrame frame)

This method is called when receiving a GO_AWAY from the other peer. We check the close state to act appropriately: <ul> <li>NOT_CLOSED: we move to REMOTELY_CLOSED and queue a disconnect, so that the content of the queue is written, and then the connection closed. We notify the application after being terminated. See <code>Http2Session.ControlEntry#succeeded()</code></li> <li>In all other cases, we do nothing since other methods are already performing their actions.</li> </ul>

onHeaders
void onHeaders(HeadersFrame frame)
Undocumented in source.
onIdleTimeout
bool onIdleTimeout()

This method is invoked when the idle timeout triggers. We check the close state to act appropriately: <ul> <li>NOT_CLOSED: it's a real idle timeout, we just initiate a close, see {@link #close(int, string, Callback)}.</li> <li>LOCALLY_CLOSED: we have sent a GO_AWAY and only shutdown the output, but the other peer did not close the connection so we never received the TCP FIN, and therefore we terminate.</li> <li>REMOTELY_CLOSED: the other peer sent us a GO_AWAY, we should have queued a disconnect, but for some reason it was not processed (for example, queue was stuck because of TCP congestion), therefore we terminate. See {@link #onGoAway(GoAwayFrame)}.</li> </ul>

onPing
void onPing(PingFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onPriority
void onPriority(PriorityFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onReset
void onReset(ResetFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onSettings
void onSettings(SettingsFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onSettings
void onSettings(SettingsFrame frame, bool reply)
Undocumented in source. Be warned that the author may not have intended to support it.
onShutdown
void onShutdown()

A typical close by a remote peer involves a GO_AWAY frame followed by TCP FIN. This method is invoked when the TCP FIN is received, or when an exception is thrown while reading, and we check the close state to act appropriately: <ul> <li>NOT_CLOSED: means that the remote peer did not send a GO_AWAY (abrupt close) or there was an exception while reading, and therefore we terminate.</li> <li>LOCALLY_CLOSED: we have sent the GO_AWAY to the remote peer, which received it and closed the connection; we queue a disconnect to close the connection on the local side. The GO_AWAY just shutdown the output, so we need this step to make sure the connection is closed. See {@link #close(int, string, Callback)}.</li> <li>REMOTELY_CLOSED: we received the GO_AWAY, and the TCP FIN afterwards, so we do nothing since the handling of the GO_AWAY will take care of closing the connection. See {@link #onGoAway(GoAwayFrame)}.</li> </ul>

onStreamClosed
void onStreamClosed(StreamSPI stream)
Undocumented in source. Be warned that the author may not have intended to support it.
onStreamOpened
void onStreamOpened(StreamSPI stream)
Undocumented in source. Be warned that the author may not have intended to support it.
onWindowUpdate
void onWindowUpdate(WindowUpdateFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onWindowUpdate
void onWindowUpdate(StreamSPI stream, WindowUpdateFrame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
ping
void ping(PingFrame frame, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
priority
int priority(PriorityFrame frame, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
push
void push(StreamSPI stream, Promise!Stream promise, PushPromiseFrame frame, Stream.Listener listener)
Undocumented in source. Be warned that the author may not have intended to support it.
removeStream
void removeStream(StreamSPI stream)
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset(ResetFrame frame, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
setInitialSessionRecvWindow
void setInitialSessionRecvWindow(int initialSessionRecvWindow)
Undocumented in source. Be warned that the author may not have intended to support it.
setMaxLocalStreams
void setMaxLocalStreams(int maxLocalStreams)
Undocumented in source. Be warned that the author may not have intended to support it.
setMaxRemoteStreams
void setMaxRemoteStreams(int maxRemoteStreams)
Undocumented in source. Be warned that the author may not have intended to support it.
setStreamIdleTimeout
void setStreamIdleTimeout(long streamIdleTimeout)
Undocumented in source. Be warned that the author may not have intended to support it.
settings
void settings(SettingsFrame frame, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
updateRecvWindow
int updateRecvWindow(int delta)
Undocumented in source. Be warned that the author may not have intended to support it.
updateSendWindow
int updateSendWindow(int delta)
Undocumented in source. Be warned that the author may not have intended to support it.
updateStreamCount
void updateStreamCount(bool local, int deltaStreams, int deltaClosing)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From SessionSPI

getStream
StreamSPI getStream(int streamId)
Undocumented in source.
removeStream
void removeStream(StreamSPI stream)

<p>Removes the given {@code stream}.</p>

frames
void frames(StreamSPI stream, Callback callback, Frame frame, Frame[] frames)

<p>Enqueues the given frames to be written to the connection.</p>

push
void push(StreamSPI stream, Promise!Stream promise, PushPromiseFrame frame, Stream.Listener listener)

<p>Enqueues the given PUSH_PROMISE frame to be written to the connection.</p> <p>Differently from {@link #frames(StreamSPI, Callback, Frame, Frame...)}, this method generates atomically the stream id for the pushed stream.</p>

data
void data(StreamSPI stream, Callback callback, DataFrame frame)

<p>Enqueues the given DATA frame to be written to the connection.</p>

updateSendWindow
int updateSendWindow(int delta)

<p>Updates the session send window by the given {@code delta}.</p>

updateRecvWindow
int updateRecvWindow(int delta)

<p>Updates the session receive window by the given {@code delta}.</p>

onWindowUpdate
void onWindowUpdate(StreamSPI stream, WindowUpdateFrame frame)

<p>Callback method invoked when a WINDOW_UPDATE frame has been received.</p>

isPushEnabled
bool isPushEnabled()

@return whether the push functionality is enabled

onShutdown
void onShutdown()

<p>Callback invoked when the connection reads -1.</p>

onIdleTimeout
bool onIdleTimeout()

<p>Callback invoked when the idle timeout expires.</p>

onFrame
void onFrame(Frame frame)

<p>Callback method invoked during an HTTP/1.1 to HTTP/2 upgrade requests to process the given synthetic frame.</p>

getBytesWritten
long getBytesWritten()

@return the number of bytes written by this session

From Listener

onData
void onData(DataFrame frame)
Undocumented in source.
onHeaders
void onHeaders(HeadersFrame frame)
Undocumented in source.
onPriority
void onPriority(PriorityFrame frame)
Undocumented in source.
onReset
void onReset(ResetFrame frame)
Undocumented in source.
onSettings
void onSettings(SettingsFrame frame)
Undocumented in source.
onPushPromise
void onPushPromise(PushPromiseFrame frame)
Undocumented in source.
onPing
void onPing(PingFrame frame)
Undocumented in source.
onGoAway
void onGoAway(GoAwayFrame frame)
Undocumented in source.
onWindowUpdate
void onWindowUpdate(WindowUpdateFrame frame)
Undocumented in source.
onConnectionFailure
void onConnectionFailure(int error, string reason)
Undocumented in source.
Adapter
class Adapter
Undocumented in source.

Meta