Contents
- Description
- Nested Class Summary
- Field Summary
- Method Summary
- Field Details
- Method Details
- getInstance()
- registerHandler(StreamType, StreamManager.StreamHandlerFactory)
- registerHandler(StreamType, StreamManager.StreamHandlerFactory, QuicStreamPriority)
- unregisterHandler(StreamType)
- isSupported(StreamType)
- createHandler(StreamType, PacketHandler, ChannelConnection)
- clearAll()
- getStreamPriority(StreamType)
Class StreamManager
java.lang.Object
com.hypixel.hytale.server.core.io.stream.StreamManager
Manages typed QUIC stream handlers and their stream priorities.
Stream handlers can be registered for specific stream types,
and will be created when clients open streams of that type.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFactory interface for creating stream handlers. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.handler.codec.quic.QuicStreamPriorityDefault QUIC stream priority for auxiliary streams that don't specify one.static final io.netty.handler.codec.quic.QuicStreamPriorityQUIC stream priority for the game stream (stream 0).static final intMaximum number of auxiliary streams a single connection may have open simultaneously. -
Method Summary
Modifier and TypeMethodDescriptionvoidclearAll()Removes all registered handlers.createHandler(StreamType type, PacketHandler packetHandler, ChannelConnection channel) Creates a handler for a stream type.static StreamManagerGets the singleton StreamManager instance.io.netty.handler.codec.quic.QuicStreamPrioritygetStreamPriority(StreamType type) Gets the QUIC stream priority for a stream type.booleanisSupported(StreamType type) Checks if a stream type has a registered handler.voidregisterHandler(StreamType type, StreamManager.StreamHandlerFactory factory) Registers a handler factory for a stream type with the default auxiliary priority.voidregisterHandler(StreamType type, StreamManager.StreamHandlerFactory factory, io.netty.handler.codec.quic.QuicStreamPriority priority) Registers a handler factory for a stream type with a specific QUIC stream priority.voidunregisterHandler(StreamType type) Unregisters a handler factory for a stream type.
-
Field Details
-
MAX_AUXILIARY_STREAMS
public static final int MAX_AUXILIARY_STREAMSMaximum number of auxiliary streams a single connection may have open simultaneously.- See Also:
-
GAME_STREAM_PRIORITY
public static final io.netty.handler.codec.quic.QuicStreamPriority GAME_STREAM_PRIORITYQUIC stream priority for the game stream (stream 0). Urgency 0 = highest priority, non-incremental = game state must arrive before anything else. -
DEFAULT_AUXILIARY_PRIORITY
public static final io.netty.handler.codec.quic.QuicStreamPriority DEFAULT_AUXILIARY_PRIORITYDefault QUIC stream priority for auxiliary streams that don't specify one. Urgency 64, non-incremental.
-
-
Method Details
-
getInstance
Gets the singleton StreamManager instance.- Returns:
- The StreamManager instance
-
registerHandler
public void registerHandler(@Nonnull StreamType type, @Nonnull StreamManager.StreamHandlerFactory factory) Registers a handler factory for a stream type with the default auxiliary priority.- Parameters:
type- The stream type to handlefactory- The factory that creates handlers for this stream type
-
registerHandler
public void registerHandler(@Nonnull StreamType type, @Nonnull StreamManager.StreamHandlerFactory factory, @Nonnull io.netty.handler.codec.quic.QuicStreamPriority priority) Registers a handler factory for a stream type with a specific QUIC stream priority.Example (plugin registering a voice stream with low-priority incremental delivery):
StreamManager.getInstance().registerHandler( StreamType.Voice, packetHandler -> new VoiceStreamHandler(packetHandler), new QuicStreamPriority(127, true) );- Parameters:
type- The stream type to handlefactory- The factory that creates handlers for this stream typepriority- The QUIC stream priority (lower urgency = higher priority)
-
unregisterHandler
Unregisters a handler factory for a stream type.- Parameters:
type- The stream type to unregister
-
isSupported
Checks if a stream type has a registered handler.- Parameters:
type- The stream type to check- Returns:
- true if the stream type is supported
-
createHandler
@Nullable public ConnectionHandler createHandler(@Nonnull StreamType type, @Nonnull PacketHandler packetHandler, @Nonnull ChannelConnection channel) Creates a handler for a stream type.- Parameters:
type- The stream typepacketHandler- The main packet handler for the connectionchannel- The channel connection for the new stream- Returns:
- A new handler for the stream, or null if the type is not supported
-
clearAll
public void clearAll()Removes all registered handlers. Intended for test isolation and plugin reload scenarios. -
getStreamPriority
@Nonnull public io.netty.handler.codec.quic.QuicStreamPriority getStreamPriority(@Nonnull StreamType type) Gets the QUIC stream priority for a stream type.- Parameters:
type- The stream type- Returns:
- The priority for this stream type, or
DEFAULT_AUXILIARY_PRIORITYif not registered
-