ConcurrentNetworkTrafficMonitor

class ConcurrentNetworkTrafficMonitor<LoginBlock>(lock: TrafficMonitorLock, val loginChannelTrafficMonitor: LoginChannelTrafficMonitor, val js5ChannelTrafficMonitor: Js5ChannelTrafficMonitor, val gameChannelTrafficMonitor: GameChannelTrafficMonitor, startDateTime: LocalDateTime = LocalDateTime.now()) : NetworkTrafficMonitor<LoginBlock>

A concurrent network traffic monitor, responsible for tracking all the data sent via the loginChannelTrafficMonitor, the js5ChannelTrafficMonitor and the gameChannelTrafficMonitor. In addition to those, it will track the number of connections established, as well as any login complete login blocks that reach the server, based on the respective InetAddress behind the login blocks. Latter can be used to link any abnormalities to specific individuals.

While this implementation is mostly atomic, it will shortly block during the resetTransient function call, while it assigns new instances to all the properties behind this implementation. This is only done to ensure consistency between the properties. As the blocking is extremely short-lived, it should not cause any issues.

Constructors

Link copied to clipboard
constructor(lock: TrafficMonitorLock, loginChannelTrafficMonitor: LoginChannelTrafficMonitor, js5ChannelTrafficMonitor: Js5ChannelTrafficMonitor, gameChannelTrafficMonitor: GameChannelTrafficMonitor, startDateTime: LocalDateTime = LocalDateTime.now())

Properties

Link copied to clipboard

the channel traffic monitor for game connections, essentially after a login request is accepted.

Link copied to clipboard

the channel traffic monitor for JS5.

Link copied to clipboard

the channel traffic monitor for logins (and "handshakes", as they are commonly referred to).

Functions

Link copied to clipboard
open override fun addLoginBlock(inetAddress: InetAddress, block: LoginBlock)

Adds a new login block from the provided inetAddress.

Link copied to clipboard
open override fun freeze()

Freezes any transient traffic monitoring for this monitor, across all three of the channel monitors. The freeze function does not stop active connection tracking, however, as that could cause bad data in the future (number of connections going negative). This will block majority of the monitoring that goes on, though. This function has no effect if the traffic was already frozen.

Link copied to clipboard
open override fun incrementConnections()

Increments connections established in total.

Link copied to clipboard

Resets any transient metrics and captures a full traffic snapshot of everything that happened prior to the resetting. This snapshot function will use a short-lived synchronization block to ensure consistency in the data captured.

Link copied to clipboard

Creates a full network traffic snapshot covering all three of the channel traffic monitors. This snapshot function will not use synchronization during creation, so it is possible for slight inconsistencies to occur due to the data being cloned at slightly different moments.

Link copied to clipboard
open override fun unfreeze()

Unfreezes any transient traffic monitoring that was frozen before. This function has no effect if the traffic was not frozen.