NetherNetLinkThread 5.46.0
Extends Thread
Owns the loopback TCP link to the NetherNet bridge process. Frames read from the bridge are handed to the main thread (waking it up through the sleeper), and frames queued by the main thread are written to the bridge.
The listening socket stays open for the lifetime of the thread so a restarted bridge can reconnect.
Constants
LINK_DOWN
php
public const LINK_DOWN = "\xf0"LINK_UP
php
public const LINK_UP = "\xf1"Synthetic frame types delivered to the main thread (never sent on the wire).
Methods
__construct()
php
public function __construct(\pmmp\thread\ThreadSafeArray $mainToThread, \pmmp\thread\ThreadSafeArray $threadToMain, \pocketmine\snooze\SleeperHandlerEntry $sleeperEntry, string $token)encodeFrame()
php
public static function encodeFrame(int $type, string $body) : stringEncodes a frame for the wire. Type is a single byte.
getThreadName()
php
public function getThreadName() : stringgetWakePort()
php
public function getWakePort() : intLoopback UDP port that wakes the thread up when the main thread queued frames.
onRun() protected
php
protected function onRun() : voidstartAndWait()
php
public function startAndWait() : intStarts the thread and returns the loopback port the bridge must connect to.
