PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
raklib\server\ServerSession Class Reference
+ Inheritance diagram for raklib\server\ServerSession:
+ Collaboration diagram for raklib\server\ServerSession:

Public Member Functions

 __construct (Server $server, \Logger $logger, InternetAddress $address, int $clientId, int $mtuSize, int $internalId, int $recvMaxSplitParts=self::DEFAULT_MAX_SPLIT_PART_COUNT, int $recvMaxConcurrentSplits=self::DEFAULT_MAX_CONCURRENT_SPLIT_COUNT)
 
 addEncapsulatedToQueue (EncapsulatedPacket $packet, bool $immediate)
 
 forciblyDisconnect (int $reason)
 
 getAddress ()
 
 getID ()
 
 getInternalId ()
 
 getState ()
 
 handlePacket (Packet $packet)
 
 initiateDisconnect (int $reason)
 
 isConnected ()
 
 isFullyDisconnected ()
 
 isTemporary ()
 
 update (float $time)
 

Public Attributes

const DEFAULT_MAX_CONCURRENT_SPLIT_COUNT = 4
 
const DEFAULT_MAX_SPLIT_PART_COUNT = 128
 
const MIN_MTU_SIZE = 400
 
const STATE_CONNECTED = 1
 
const STATE_CONNECTING = 0
 
const STATE_DISCONNECT_NOTIFIED = 3
 
const STATE_DISCONNECT_PENDING = 2
 
const STATE_DISCONNECTED = 4
 

Protected Member Functions

 getRakNetTimeMS ()
 
 handleRakNetConnectionPacket (string $packet)
 
 onDisconnect (int $reason)
 
 onPacketAck (int $identifierACK)
 
 onPacketReceive (string $packet)
 
 onPingMeasure (int $pingMS)
 
 queueConnectedPacket (ConnectedPacket $packet, int $reliability, int $orderChannel, bool $immediate=false)
 
 sendPacket (Packet $packet)
 
 sendPing (int $reliability=PacketReliability::UNRELIABLE)
 

Protected Attributes

InternetAddress $address
 
int $state = self::STATE_CONNECTING
 

Detailed Description

Definition at line 30 of file ServerSession.php.

Constructor & Destructor Documentation

◆ __construct()

raklib\server\ServerSession::__construct ( Server $server,
\Logger $logger,
InternetAddress $address,
int $clientId,
int $mtuSize,
int $internalId,
int $recvMaxSplitParts = self::DEFAULT_MAX_SPLIT_PART_COUNT,
int $recvMaxConcurrentSplits = self::DEFAULT_MAX_CONCURRENT_SPLIT_COUNT )

Definition at line 37 of file ServerSession.php.

Member Function Documentation

◆ addEncapsulatedToQueue()

raklib\generic\Session::addEncapsulatedToQueue ( EncapsulatedPacket $packet,
bool $immediate )
inherited

Definition at line 230 of file Session.php.

◆ forciblyDisconnect()

raklib\generic\Session::forciblyDisconnect ( int $reason)
inherited

Disconnects the session with immediate effect, regardless of current session state. Usually used in timeout cases.

Parameters
int$reasonone of the DisconnectReason constants @phpstan-param DisconnectReason::* $reason
See also
DisconnectReason

Definition at line 316 of file Session.php.

◆ getAddress()

raklib\generic\Session::getAddress ( )
inherited

Definition at line 158 of file Session.php.

◆ getID()

raklib\generic\Session::getID ( )
inherited

Definition at line 162 of file Session.php.

◆ getInternalId()

raklib\server\ServerSession::getInternalId ( )

Returns an ID used to identify this session across threads.

Definition at line 55 of file ServerSession.php.

◆ getRakNetTimeMS()

raklib\generic\Session::getRakNetTimeMS ( )
protectedinherited

Returns a monotonically increasing timestamp. It does not need to match UNIX time. This is used to calculate ping.

Definition at line 154 of file Session.php.

◆ getState()

raklib\generic\Session::getState ( )
inherited

Definition at line 166 of file Session.php.

◆ handlePacket()

raklib\generic\Session::handlePacket ( Packet $packet)
inherited

Definition at line 278 of file Session.php.

◆ handleRakNetConnectionPacket()

raklib\server\ServerSession::handleRakNetConnectionPacket ( string $packet)
finalprotected

Called when a packet is received while the session is in the "connecting" state. This should only handle RakNet connection packets. Any other packets should be ignored.

Reimplemented from raklib\generic\Session.

Definition at line 71 of file ServerSession.php.

◆ initiateDisconnect()

raklib\generic\Session::initiateDisconnect ( int $reason)
inherited

Initiates a graceful asynchronous disconnect which ensures both parties got all packets.

Parameters
int$reasonone of the DisconnectReason constants @phpstan-param DisconnectReason::* $reason
See also
DisconnectReason

Definition at line 299 of file Session.php.

◆ isConnected()

raklib\generic\Session::isConnected ( )
inherited

Definition at line 174 of file Session.php.

◆ isFullyDisconnected()

raklib\generic\Session::isFullyDisconnected ( )
inherited

Returns whether the session is ready to be destroyed (either properly cleaned up or forcibly terminated)

Definition at line 339 of file Session.php.

◆ isTemporary()

raklib\generic\Session::isTemporary ( )
inherited

Definition at line 170 of file Session.php.

◆ onDisconnect()

raklib\server\ServerSession::onDisconnect ( int $reason)
protected

Called when the session is terminated for any reason.

Parameters
int$reasonone of the DisconnectReason::* constants @phpstan-param DisconnectReason::* $reason
See also
DisconnectReason

Reimplemented from raklib\generic\Session.

Definition at line 67 of file ServerSession.php.

◆ onPacketAck()

raklib\server\ServerSession::onPacketAck ( int $identifierACK)
protected

Called when a packet for which an ACK was requested is ACKed.

Reimplemented from raklib\generic\Session.

Definition at line 63 of file ServerSession.php.

◆ onPacketReceive()

raklib\server\ServerSession::onPacketReceive ( string $packet)
protected

Called when a user packet (ID >= ID_USER_PACKET_ENUM) is received from the remote peer.

See also
MessageIdentifiers::ID_USER_PACKET_ENUM

Reimplemented from raklib\generic\Session.

Definition at line 96 of file ServerSession.php.

◆ onPingMeasure()

raklib\server\ServerSession::onPingMeasure ( int $pingMS)
protected

Called when a new ping measurement is recorded.

Reimplemented from raklib\generic\Session.

Definition at line 100 of file ServerSession.php.

◆ queueConnectedPacket()

raklib\generic\Session::queueConnectedPacket ( ConnectedPacket $packet,
int $reliability,
int $orderChannel,
bool $immediate = false )
protectedinherited

Definition at line 218 of file Session.php.

◆ sendPacket()

raklib\server\ServerSession::sendPacket ( Packet $packet)
finalprotected

Sends a packet in the appropriate way for the session type.

Reimplemented from raklib\generic\Session.

Definition at line 59 of file ServerSession.php.

◆ sendPing()

raklib\generic\Session::sendPing ( int $reliability = PacketReliability::UNRELIABLE)
protectedinherited

Definition at line 234 of file Session.php.

◆ update()

raklib\generic\Session::update ( float $time)
inherited

Definition at line 181 of file Session.php.

Member Data Documentation

◆ $address

InternetAddress raklib\generic\Session::$address
protectedinherited

Definition at line 50 of file Session.php.

◆ $state

int raklib\generic\Session::$state = self::STATE_CONNECTING
protectedinherited

Definition at line 52 of file Session.php.

◆ DEFAULT_MAX_CONCURRENT_SPLIT_COUNT

const raklib\server\ServerSession::DEFAULT_MAX_CONCURRENT_SPLIT_COUNT = 4

Definition at line 32 of file ServerSession.php.

◆ DEFAULT_MAX_SPLIT_PART_COUNT

const raklib\server\ServerSession::DEFAULT_MAX_SPLIT_PART_COUNT = 128

Definition at line 31 of file ServerSession.php.

◆ MIN_MTU_SIZE

const raklib\generic\Session::MIN_MTU_SIZE = 400
inherited

Definition at line 46 of file Session.php.

◆ STATE_CONNECTED

const raklib\generic\Session::STATE_CONNECTED = 1
inherited

Definition at line 41 of file Session.php.

◆ STATE_CONNECTING

const raklib\generic\Session::STATE_CONNECTING = 0
inherited

Definition at line 40 of file Session.php.

◆ STATE_DISCONNECT_NOTIFIED

const raklib\generic\Session::STATE_DISCONNECT_NOTIFIED = 3
inherited

Definition at line 43 of file Session.php.

◆ STATE_DISCONNECT_PENDING

const raklib\generic\Session::STATE_DISCONNECT_PENDING = 2
inherited

Definition at line 42 of file Session.php.

◆ STATE_DISCONNECTED

const raklib\generic\Session::STATE_DISCONNECTED = 4
inherited

Definition at line 44 of file Session.php.


The documentation for this class was generated from the following file: