Class QuicConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connection
,Invocable
- Direct Known Subclasses:
ClientQuicConnection
,ServerQuicConnection
A Connection
implementation that receives and sends datagram packets via its associated DatagramChannelEndPoint
.
The received bytes are peeked to obtain the QUIC connection ID; each QUIC connection ID has an associated
QuicSession
, and the received bytes are then passed to the QuicSession
for processing.
On the receive side, one QuicConnection fans-out to multiple QuicSession
s.
On the send side, many QuicSession
s fan-in to one QuicConnection.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
-
Field Summary
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
-
Constructor Summary
ModifierConstructorDescriptionprotected
QuicConnection
(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, EndPoint endPoint) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(EventListener listener) Adds a listener of connection events.void
close()
Performs a logical close of this connection.protected abstract QuicSession
createSession
(SocketAddress remoteAddress, ByteBuffer cipherBuffer) void
Utility method to be called to register read interest.abstract InetSocketAddress
int
boolean
boolean
void
Callback method invoked when this connection is closed.protected void
void
Callback method invoked when the endpoint is ready to be read.abstract boolean
onIdleExpired
(TimeoutException timeoutException) Callback method invoked upon an idle timeout event.void
onOpen()
Callback method invoked when this connection is opened.void
outwardClose
(QuicSession session, Throwable failure) protected Runnable
process
(QuicSession session, SocketAddress remoteAddress, ByteBuffer cipherBuffer) void
removeEventListener
(EventListener listener) Removes a listener of connection events.void
setOutputBufferSize
(int outputBufferSize) void
setUseInputDirectByteBuffers
(boolean useInputDirectByteBuffers) void
setUseOutputDirectByteBuffers
(boolean useOutputDirectByteBuffers) void
write
(Callback callback, SocketAddress remoteAddress, ByteBuffer... buffers) Methods inherited from class org.eclipse.jetty.io.AbstractConnection
failedCallback, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getInvocationType, getMessagesIn, getMessagesOut, isFillInterested, onFillInterestedFailed, onReadTimeout, setInputBufferSize, toConnectionString, toString, tryFillInterested
-
Constructor Details
-
QuicConnection
protected QuicConnection(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, EndPoint endPoint)
-
-
Method Details
-
getScheduler
-
getByteBufferPool
-
getOutputBufferSize
public int getOutputBufferSize() -
setOutputBufferSize
public void setOutputBufferSize(int outputBufferSize) -
isUseInputDirectByteBuffers
public boolean isUseInputDirectByteBuffers() -
setUseInputDirectByteBuffers
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) -
isUseOutputDirectByteBuffers
public boolean isUseOutputDirectByteBuffers() -
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
getQuicSessions
-
addEventListener
Description copied from interface:Connection
Adds a listener of connection events.
- Specified by:
addEventListener
in interfaceConnection
- Overrides:
addEventListener
in classAbstractConnection
- Parameters:
listener
- the listener to add
-
removeEventListener
Description copied from interface:Connection
Removes a listener of connection events.
- Specified by:
removeEventListener
in interfaceConnection
- Overrides:
removeEventListener
in classAbstractConnection
- Parameters:
listener
- the listener to remove
-
onOpen
public void onOpen()Description copied from interface:Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onOpen
in interfaceConnection
- Overrides:
onOpen
in classAbstractConnection
-
onClose
Description copied from interface:Connection
Callback method invoked when this connection is closed.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onClose
in interfaceConnection
- Overrides:
onClose
in classAbstractConnection
- Parameters:
cause
- The cause of the close or null for a normal close
-
onFillable
public void onFillable()Description copied from class:AbstractConnection
Callback method invoked when the endpoint is ready to be read.
- Specified by:
onFillable
in classAbstractConnection
- See Also:
-
fillInterested
public void fillInterested()Description copied from class:AbstractConnection
Utility method to be called to register read interest.
After a call to this method,
AbstractConnection.onFillable()
orAbstractConnection.onFillInterestedFailed(Throwable)
will be called back as appropriate.- Overrides:
fillInterested
in classAbstractConnection
- See Also:
-
onIdleExpired
Description copied from interface:Connection
Callback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
- Specified by:
onIdleExpired
in interfaceConnection
- Overrides:
onIdleExpired
in classAbstractConnection
- Returns:
- true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
-
close
public void close()Description copied from interface:Connection
Performs a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPoint
but, for example, SSL connections should write the SSL close message before closing the associatedEndPoint
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classAbstractConnection
-
outwardClose
-
createSession
protected abstract QuicSession createSession(SocketAddress remoteAddress, ByteBuffer cipherBuffer) throws IOException - Throws:
IOException
-
getLocalInetSocketAddress
-
write
-
process
protected Runnable process(QuicSession session, SocketAddress remoteAddress, ByteBuffer cipherBuffer) -
onFailure
-