Class QuicheSession
- All Implemented Interfaces:
Session
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
Represents a logical connection with a remote peer, identified by a QUIC connection id.
Bytes received from a QuicheConnection
in feed(SocketAddress, ByteBuffer)
are passed to Quiche for processing; in turn, Quiche produces a list of QUIC stream ids that
have pending I/O events, either read-ready or write-ready.
On the receive side, a QuicheSession fans-out to multiple QuicheStream
s.
On the send side, many QuicheStream
s fan-in to a QuicheSession.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.quic.common.AbstractSession
AbstractSession.Listener
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer, Dumpable.DumpAppendable
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionQuicheSession
(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, QuicConfiguration configuration, Quiche quiche, QuicheConnection connection, SocketAddress localAddress, SocketAddress remoteAddress, Session.Listener listener) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
data
(QuicheStream stream, boolean last, ByteBuffer buffer) void
disconnect
(ConnectionCloseFrame frame, Throwable failure, Promise.Invocable<Session> promise) Disconnects this session, with the givenCONNECTION_CLOSE
and failure cause, if any.void
feed
(SocketAddress remoteAddress, ByteBuffer cipherBuffer) void
flush()
protected QuicheConnection
getId()
long
long
Returns the peer certificates chain.getStream
(long streamId) boolean
boolean
isOpen()
void
maxData
(MaxDataFrame frame, Promise.Invocable<Session> promise) Sends a MAX_DATA frame on this connection.void
maxStreams
(MaxStreamsFrame frame, Promise.Invocable<Session> promise) Sends a MAX_STREAMS frame on this connection.newStream
(long streamId, Stream.Listener listener) Creates a new local QUIC stream with the given stream id and listener.void
boolean
onIdleTimeout
(TimeoutException timeout) void
open()
void
ping
(Promise.Invocable<Session> promise) Sends a PING frame on this connection.void
produce()
void
setConnectionId
(QuicheConnectionId connectionId) void
setIdleTimeout
(long idleTimeout) Methods inherited from class org.eclipse.jetty.quic.common.AbstractSession
close, emitDisconnect, emitOpen, getExecutor, getListener, getQuicConfiguration, notifyClose, notifyDataBlocked, notifyDisconnect, notifyIdleTimeout, notifyLocalClose, notifyMaxData, notifyMaxStreams, notifyNewStream, notifyOpen, notifyPing, notifyPrepare, notifyStreamsBlocked, notifyTransportParameters, shutdown, toString
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListeners
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
Methods inherited from interface org.eclipse.jetty.quic.api.Session
newStreamId
-
Constructor Details
-
QuicheSession
public QuicheSession(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, QuicConfiguration configuration, Quiche quiche, QuicheConnection connection, SocketAddress localAddress, SocketAddress remoteAddress, Session.Listener listener)
-
-
Method Details
-
getScheduler
-
getByteBufferPool
-
getConnection
-
getNegotiatedProtocol
-
getId
- Returns:
- the QUIC connection id
-
newStream
Description copied from interface:Session
Creates a new local QUIC stream with the given stream id and listener.
- Parameters:
streamId
- the QUIC stream idlistener
- the listener of stream events- Returns:
- a new local QUIC stream
-
getStream
- Parameters:
streamId
- the stream id- Returns:
- the QUIC stream with the given stream id
-
getStreams
- Returns:
- the QUIC streams managed by this session
-
maxStreams
Description copied from interface:Session
Sends a MAX_STREAMS frame on this connection.
- Parameters:
frame
- the frame to sendpromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
ping
Description copied from interface:Session
Sends a PING frame on this connection.
- Parameters:
promise
- thePromise.Invocable
that gets notified when the frame has been sent
-
maxData
Description copied from interface:Session
Sends a MAX_DATA frame on this connection.
- Parameters:
frame
- the frame to sendpromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
disconnect
public void disconnect(ConnectionCloseFrame frame, Throwable failure, Promise.Invocable<Session> promise) Description copied from interface:Session
Disconnects this session, with the given
CONNECTION_CLOSE
and failure cause, if any.Differently from
Session.close(ConnectionCloseFrame, Promise.Invocable)
, this method performs disconnect actions outwards, towards the network: typically clean-up actions and eventually sends the given QUIC close frame and finally disconnect at the network level, if necessary.- Parameters:
frame
- the frame carrying the error code and reasonfailure
- the failure that caused the disconnect, ornull
promise
- thePromise.Invocable
that gets notified when the disconnect is complete
-
getLocalSocketAddress
- Returns:
- the local
SocketAddress
associated with this session
-
getRemoteSocketAddress
- Returns:
- the remote
SocketAddress
associated with this session
-
getLocalBidirectionalMaxStreams
public long getLocalBidirectionalMaxStreams()- Returns:
- the local bidirectional streams max count
-
getIdleTimeout
public long getIdleTimeout()- Returns:
- the idle timeout in milliseconds
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout) -
onIdleTimeout
-
getConnectionId
-
setConnectionId
-
feed
- Throws:
IOException
-
isConnectionEstablished
public boolean isConnectionEstablished() -
getPeerCertificates
Returns the peer certificates chain.
Due to current Quiche C API limitations (that the Rust version does not have), only the last certificate in the chain is returned. This may change in the future when the C APIs are aligned to the Rust APIs.
- Specified by:
getPeerCertificates
in classAbstractSession
- Returns:
- the peer certificates chain (currently only the last certificate in the chain)
-
produce
public void produce() -
data
- Throws:
IOException
-
offerTask
- Specified by:
offerTask
in classAbstractSession
-
flush
public void flush() -
isOpen
public boolean isOpen() -
open
public void open()
-