PacketHandler

abstract class PacketHandler implements IPacketReceiver

Class PacketHandler. Provides packethandler functionality for the Hytale server.

java.lang.Object > PacketHandler

Field Summary

auth

protected PlayerAuthentication auth

Field auth.

queuePackets

protected boolean queuePackets

Field queuePackets.

pingTimer

private float pingTimer

Field pingTimer.

registered

protected boolean registered

Field registered.

timeoutTask

private ScheduledFuture timeoutTask

Field timeoutTask.

clientReadyForChunksFutureStack

protected Throwable clientReadyForChunksFutureStack

Field clientReadyForChunksFutureStack.

clientReadyForChunksFuture

protected CompletableFuture clientReadyForChunksFuture

Field clientReadyForChunksFuture.

cachedPackets

final Packet[] cachedPackets

Field cachedPackets.

packet

final Packet packet

Field packet.

average

final double average

Field average.

id

final int id

Field id.

nowInstant

final Instant nowInstant

Field nowInstant.

nowTimestamp

final long nowTimestamp

Field nowTimestamp.

channel

final Channel channel

Field channel.

address

final InetAddress address

Field address.

loginStartAttribute

final Attribute loginStartAttribute

Field loginStartAttribute.

now

final long now

Field now.

before

final Long before

Field before.

nanoTime

final long nanoTime

Field nanoTime.

pingValue

final long pingValue

Field pingValue.

serverDisconnectReason

private String serverDisconnectReason

Field serverDisconnectReason.

clientDisconnectType

private DisconnectType clientDisconnectType

Field clientDisconnectType.

Method Detail

PacketHandler

public public PacketHandler (@Nonnull final Channel channel, @Nonnull final ProtocolVersion protocolVersion)

Method PacketHandler.

Parameters:
@Nonnull final Channel channel
@Nonnull final ProtocolVersion protocolVersion

getChannel

public Channel getChannel ()

Method getChannel.

setCompressionEnabled

public void setCompressionEnabled (final boolean compressionEnabled)

Method setCompressionEnabled.

Parameters:
final boolean compressionEnabled

isCompressionEnabled

public boolean isCompressionEnabled ()

Method isCompressionEnabled.

getProtocolVersion

public ProtocolVersion getProtocolVersion ()

Method getProtocolVersion.

registered

final void registered (@Nullable final PacketHandler oldHandler)

Method registered.

Parameters:
@Nullable final PacketHandler oldHandler

registered0

protected void registered0 (@Nullable final PacketHandler oldHandler)

Method registered0.

Parameters:
@Nullable final PacketHandler oldHandler

unregistered

final void unregistered (@Nullable final PacketHandler newHandler)

Method unregistered.

Parameters:
@Nullable final PacketHandler newHandler

unregistered0

protected void unregistered0 (@Nullable final PacketHandler newHandler)

Method unregistered0.

Parameters:
@Nullable final PacketHandler newHandler

handle

public void handle (@Nonnull final Packet packet)

Method handle.

Parameters:
@Nonnull final Packet packet

logCloseMessage

public void logCloseMessage ()

Method logCloseMessage.

closed

public void closed (final ChannelHandlerContext ctx)

Method closed.

Parameters:
final ChannelHandlerContext ctx

setQueuePackets

public void setQueuePackets (final boolean queuePackets)

Method setQueuePackets.

Parameters:
final boolean queuePackets

tryFlush

public void tryFlush ()

Method tryFlush.

write

public void write (@Nonnull final Packet... packets)

Method write.

Parameters:
@Nonnull final Packet... packets

writeNoCache

public void writeNoCache (@Nonnull final Packet packet)

Method writeNoCache.

Parameters:
@Nonnull final Packet packet

writePacket

public void writePacket (@Nonnull final Packet packet, final boolean cache)

Method writePacket.

Parameters:
@Nonnull final Packet packet
final boolean cache

handleOutboundAndCachePackets

private void handleOutboundAndCachePackets (@Nonnull final Packet[] packets, @Nonnull final Packet[] cachedPackets)

Method handleOutboundAndCachePackets.

Parameters:
@Nonnull final Packet[] packets
@Nonnull final Packet[] cachedPackets

handleOutboundAndCachePacket

private Packet handleOutboundAndCachePacket (@Nonnull final Packet packet)

Method handleOutboundAndCachePacket.

Parameters:
@Nonnull final Packet packet

disconnect

public void disconnect (@Nonnull final String message)

Method disconnect.

Parameters:
@Nonnull final String message

disconnect0

protected void disconnect0 (@Nonnull final String message)

Method disconnect0.

Parameters:
@Nonnull final String message

Disconnect

public new Disconnect (message, DisconnectType.Disconnect)

Method Disconnect.

Parameters:
message message
DisconnectType.Disconnect DisconnectType.Disconnect

getPacketStatsRecorder

public PacketStatsRecorder getPacketStatsRecorder ()

Method getPacketStatsRecorder.

getPingInfo

public PingInfo getPingInfo (@Nonnull final PongType pongType)

Method getPingInfo.

Parameters:
@Nonnull final PongType pongType

getOperationTimeoutThreshold

public long getOperationTimeoutThreshold ()

Method getOperationTimeoutThreshold.

tickPing

public void tickPing (final float dt)

Method tickPing.

Parameters:
final float dt

sendPing

public void sendPing ()

Method sendPing.

Ping

public new Ping (id, WorldTimeResource.instantToInstantData(nowInstant)

Method Ping.

Parameters:
id id
WorldTimeResource.instantToInstantData(nowInstant WorldTimeResource.instantToInstantData(nowInstant

handlePong

public void handlePong (@Nonnull final Pong packet)

Method handlePong.

Parameters:
@Nonnull final Pong packet

setTimeout

protected void setTimeout (@Nonnull final String stageId, @Nonnull final BooleanSupplier meets, final long def, @Nonnull final TimeUnit timeUnit)

Method setTimeout.

Parameters:
@Nonnull final String stageId
@Nonnull final BooleanSupplier meets
final long def
@Nonnull final TimeUnit timeUnit

clearTimeout

protected void clearTimeout ()

Method clearTimeout.

getAuth

public PlayerAuthentication getAuth ()

Method getAuth.

stillActive

public boolean stillActive ()

Method stillActive.

getQueuedPacketsCount

public int getQueuedPacketsCount ()

Method getQueuedPacketsCount.

isLocalConnection

public boolean isLocalConnection ()

Method isLocalConnection.

isLANConnection

public boolean isLANConnection ()

Method isLANConnection.

getDisconnectReason

public DisconnectReason getDisconnectReason ()

Method getDisconnectReason.

setClientReadyForChunksFuture

public void setClientReadyForChunksFuture (@Nonnull final CompletableFuture clientReadyFuture)

Method setClientReadyForChunksFuture.

Parameters:
@Nonnull final CompletableFuture clientReadyFuture

getClientReadyForChunksFuture

public CompletableFuture getClientReadyForChunksFuture ()

Method getClientReadyForChunksFuture.

logConnectionTimings

static void logConnectionTimings (@Nonnull final Channel channel, @Nonnull final String message, @Nonnull final Level level)

Method logConnectionTimings.

Parameters:
@Nonnull final Channel channel
@Nonnull final String message
@Nonnull final Level level

recordSent

protected void recordSent (final int id, final long timestamp)

Method recordSent.

Parameters:
final int id
final long timestamp

handlePacket

protected void handlePacket (@Nonnull final Pong packet)

Method handlePacket.

Parameters:
@Nonnull final Pong packet

IllegalArgumentException

public new IllegalArgumentException ("Got packet for " + String.valueOf(packet.type)

Method IllegalArgumentException.

Parameters:
"Got packet for " + String.valueOf(packet.type

getPingType

public PongType getPingType ()

Method getPingType.

getPacketQueueMetric

public Metric getPacketQueueMetric ()

Method getPacketQueueMetric.

getPingMetricSet

public HistoricMetric getPingMetricSet ()

Method getPingMetricSet.

clear

public void clear ()

Method clear.

getServerDisconnectReason

public String getServerDisconnectReason ()

Method getServerDisconnectReason.

setServerDisconnectReason

public void setServerDisconnectReason (final String serverDisconnectReason)

Method setServerDisconnectReason.

Parameters:
final String serverDisconnectReason

getClientDisconnectType

public DisconnectType getClientDisconnectType ()

Method getClientDisconnectType.

setClientDisconnectType

public void setClientDisconnectType (final DisconnectType clientDisconnectType)

Method setClientDisconnectType.

Parameters:
final DisconnectType clientDisconnectType

toString

public String toString ()

Method toString.