Class QuicSession
- All Implemented Interfaces:
Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
- Direct Known Subclasses:
ClientQuicSession
,ServerQuicSession
Represents a logical connection with a remote peer, identified by a QUIC connection ID.
Each QuicSession maintains a number of QUIC streams, identified by their QUIC stream ID;
Each QUIC stream is wrapped in an EndPoint
, namely QuicStreamEndPoint
.
Bytes received from a QuicConnection
in process(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 QuicSession fans-out to multiple QuicStreamEndPoint
s.
On the send side, many QuicStreamEndPoint
s fan-in to a QuicSession.
- See Also:
-
Nested Class Summary
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
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
QuicSession
(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, org.eclipse.jetty.quic.quiche.QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ProtocolSession
protected void
doStart()
Starts the managed lifecycle beans in the order they were added.protected void
doStop()
Stops the managed lifecycle beans in the reverse order they were added.void
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.int
fill
(long streamId, ByteBuffer buffer) void
flush()
int
flush
(long streamId, ByteBuffer buffer, boolean last) org.eclipse.jetty.quic.quiche.QuicheConnectionId
long
int
getOrCreateStreamEndPoint
(long streamId, Consumer<QuicStreamEndPoint> consumer) Returns the peer certificates chain.long
long
getWindowCapacity
(long streamId) void
inwardClose
(long error, String reason) boolean
boolean
isFinished
(long streamId) abstract Connection
newConnection
(QuicStreamEndPoint endPoint) long
newStreamId
(StreamType streamType) void
boolean
void
outwardClose
(long error, String reason) protected Runnable
pollTask()
process
(SocketAddress remoteAddress, ByteBuffer cipherBufferIn) void
remove
(QuicStreamEndPoint endPoint, Throwable failure) void
setConnectionId
(org.eclipse.jetty.quic.quiche.QuicheConnectionId quicheConnectionId) void
setIdleTimeout
(long idleTimeout) shutdown()
void
shutdownInput
(long streamId, long error) void
shutdownOutput
(long streamId, long error) toString()
protected abstract boolean
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, 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
-
Constructor Details
-
QuicSession
protected QuicSession(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, org.eclipse.jetty.quic.quiche.QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress)
-
-
Method Details
-
doStart
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classContainerLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classContainerLifeCycle
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
shutdown
-
getExecutor
-
getScheduler
-
getByteBufferPool
-
getProtocolSession
-
getMaxLocalStreams
public int getMaxLocalStreams() -
getNegotiatedProtocol
-
getQuicConnection
-
getQuicStreamEndPoints
-
getRemoteCloseInfo
-
getIdleTimeout
public long getIdleTimeout() -
setIdleTimeout
public void setIdleTimeout(long idleTimeout) -
onIdleTimeout
public boolean onIdleTimeout() -
onFailure
-
newStreamId
- Parameters:
streamType
- the stream type- Returns:
- a new stream ID for the given type
-
fill
- Throws:
IOException
-
flush
- Throws:
IOException
-
isFinished
public boolean isFinished(long streamId) -
getWindowCapacity
public long getWindowCapacity() -
getWindowCapacity
- Throws:
IOException
-
shutdownInput
- Throws:
IOException
-
shutdownOutput
- Throws:
IOException
-
remove
-
getLocalAddress
-
getRemoteAddress
-
isConnectionEstablished
public boolean isConnectionEstablished() -
getConnectionId
public org.eclipse.jetty.quic.quiche.QuicheConnectionId getConnectionId() -
setConnectionId
public void setConnectionId(org.eclipse.jetty.quic.quiche.QuicheConnectionId quicheConnectionId) -
process
- Throws:
IOException
-
pollTask
-
createProtocolSession
-
validateNewlyEstablishedConnection
protected abstract boolean validateNewlyEstablishedConnection()- Returns:
- true if the connection is valid, false otherwise.
-
newConnection
-
flush
public void flush() -
getOrCreateStreamEndPoint
public QuicStreamEndPoint getOrCreateStreamEndPoint(long streamId, Consumer<QuicStreamEndPoint> consumer) -
inwardClose
-
outwardClose
-
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.
- Returns:
- the peer certificates chain (currently only the last certificate in the chain)
-
dump
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Overrides:
dump
in classContainerLifeCycle
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
toString
- Overrides:
toString
in classAbstractLifeCycle
-