LoginChannelTrafficMonitor

A wrapper for login channel traffic monitor. The wrapper class allows us to write extension functions specifically targeted at the login-implementation.

Constructors

Link copied to clipboard
constructor(channelTrafficMonitor: ChannelTrafficMonitor)

Functions

Link copied to clipboard
open override fun addDisconnectionReason(inetAddress: InetAddress, reason: Int)

Adds a channel disconnection reason from the provided inetAddress.

Link copied to clipboard
open override fun decrementConnections(inetAddress: InetAddress)

Decrements connections from the provided inetAddress. This function is called when a channel handler is unregistered in Netty. Whenever a handler switches from one to another, the old one will be unregistered first, before the new one is registered. An example of this is moving from login to JS5. The exact flow is:

Link copied to clipboard
open override fun elapsed(): Duration

The duration for how long we've currently been measuring the traffic in this channel. This value is essentially just LocalDateTime.now minus startDateTime. The JvmSynthetic annotation is implied, since Duration is a value class, it would not be visible from Java anyway.

Link copied to clipboard
open override fun elapsedMillis(): Long

The duration for how long we've currently been measuring the traffic in this channel, in milliseconds. This value is essentially just LocalDateTime.now minus startDateTime.

Link copied to clipboard
open override fun freeze()

Freezes tracking of any transient metrics in this channel's traffic monitor. While frozen, metrics such as incoming packets, outgoing packets and disconnections will not be updated. Active connections, however, are not impacted by the freezes, and will continue to monitor any connected channels.

Link copied to clipboard
open override fun incrementConnections(inetAddress: InetAddress)

Increments connections from the provided inetAddress. This function is called when a channel handler is registered in Netty.

Link copied to clipboard
open override fun incrementIncomingPackets(inetAddress: InetAddress, opcode: Int, payloadSize: Int)

Increments the incoming packets received from the provided inetAddress.

Link copied to clipboard
open override fun incrementOutgoingPacketOpcode(inetAddress: InetAddress, opcode: Int)

Increments the outgoing packet opcode counter alone, without the payload increase. We require a special function for this since our JS5Service implementation fragments the payloads into blocks of X bytes. Due to the nature of it, we may only have a single packet header, but a hundred slices of that packet's payload.

Link copied to clipboard
open override fun incrementOutgoingPacketPayload(inetAddress: InetAddress, opcode: Int, payloadSize: Int)

Increments the outgoing packet payload sent to the provided inetAddress.

Link copied to clipboard
open override fun incrementOutgoingPackets(inetAddress: InetAddress, opcode: Int, payloadSize: Int)

Increments the outgoing packets sent to the provided inetAddress.

Link copied to clipboard

Resets all the transient channel traffic values, and returns a snapshot of what the state was just before the resetting.

Link copied to clipboard
open override fun snapshot(): ChannelTrafficSnapshot

Captures a snapshot of the traffic in this channel since the last reset (or when it began measuring, if it has never been reset). This function will not synchronize or reset any of the metrics.

Link copied to clipboard
open override fun startDateTime(): LocalDateTime

The local datetime when the traffic began measuring. This value will be reset whenever the resetTransient function is called.

Link copied to clipboard
open override fun unfreeze()

Un-freezes tracking of any transient metrics in this channel's traffic monitor. Once unfrozen, the transient information such as incoming packets, outgoing packets and disconnections will continue to be added to the traffic monitor.