Session
in package
Table of Contents
- MAX_CONCURRENT_SPLIT_COUNT = 4
- MAX_SPLIT_PART_COUNT = 128
- MIN_MTU_SIZE = 400
- STATE_CONNECTED = 1
- STATE_CONNECTING = 0
- STATE_DISCONNECT_NOTIFIED = 3
- STATE_DISCONNECT_PENDING = 2
- STATE_DISCONNECTED = 4
- $address : InternetAddress
- $disconnectionTime : float
- $id : int
- $internalId : int
- $isActive : bool
- $isTemporal : bool
- $lastPingMeasure : int
- $lastPingTime : float
- $lastUpdate : float
- $logger : Logger
- $recvLayer : ReceiveReliabilityLayer
- $sendLayer : SendReliabilityLayer
- $server : Server
- $state : int
- __construct() : mixed
- addEncapsulatedToQueue() : void
- forciblyDisconnect() : void
- Disconnects the session with immediate effect, regardless of current session state. Usually used in timeout cases.
- getAddress() : InternetAddress
- getID() : int
- getInternalId() : int
- Returns an ID used to identify this session across threads.
- getState() : int
- handlePacket() : void
- initiateDisconnect() : void
- Initiates a graceful asynchronous disconnect which ensures both parties got all packets.
- isConnected() : bool
- isFullyDisconnected() : bool
- Returns whether the session is ready to be destroyed (either properly cleaned up or forcibly terminated)
- isTemporal() : bool
- update() : void
- handleEncapsulatedPacketRoute() : void
- handlePong() : void
- onClientDisconnect() : void
- queueConnectedPacket() : void
- sendPacket() : void
- sendPing() : void
Constants
MAX_CONCURRENT_SPLIT_COUNT
public
mixed
MAX_CONCURRENT_SPLIT_COUNT
= 4
MAX_SPLIT_PART_COUNT
public
mixed
MAX_SPLIT_PART_COUNT
= 128
MIN_MTU_SIZE
public
mixed
MIN_MTU_SIZE
= 400
STATE_CONNECTED
public
mixed
STATE_CONNECTED
= 1
STATE_CONNECTING
public
mixed
STATE_CONNECTING
= 0
STATE_DISCONNECT_NOTIFIED
public
mixed
STATE_DISCONNECT_NOTIFIED
= 3
STATE_DISCONNECT_PENDING
public
mixed
STATE_DISCONNECT_PENDING
= 2
STATE_DISCONNECTED
public
mixed
STATE_DISCONNECTED
= 4
Properties
$address
private
InternetAddress
$address
$disconnectionTime
private
float
$disconnectionTime
= 0
$id
private
int
$id
$internalId
private
int
$internalId
$isActive
private
bool
$isActive
= false
$isTemporal
private
bool
$isTemporal
= true
$lastPingMeasure
private
int
$lastPingMeasure
= 1
$lastPingTime
private
float
$lastPingTime
= -1
$lastUpdate
private
float
$lastUpdate
$logger
private
Logger
$logger
$recvLayer
private
ReceiveReliabilityLayer
$recvLayer
$sendLayer
private
SendReliabilityLayer
$sendLayer
$server
private
Server
$server
$state
private
int
$state
= self::STATE_CONNECTING
Methods
__construct()
public
__construct(Server $server, Logger $logger, InternetAddress $address, int $clientId, int $mtuSize, int $internalId) : mixed
Parameters
- $server : Server
- $logger : Logger
- $address : InternetAddress
- $clientId : int
- $mtuSize : int
- $internalId : int
Return values
mixed —addEncapsulatedToQueue()
public
addEncapsulatedToQueue(EncapsulatedPacket $packet, bool $immediate) : void
Parameters
- $packet : EncapsulatedPacket
- $immediate : bool
Return values
void —forciblyDisconnect()
Disconnects the session with immediate effect, regardless of current session state. Usually used in timeout cases.
public
forciblyDisconnect(string $reason) : void
Parameters
- $reason : string
Return values
void —getAddress()
public
getAddress() : InternetAddress
Return values
InternetAddress —getID()
public
getID() : int
Return values
int —getInternalId()
Returns an ID used to identify this session across threads.
public
getInternalId() : int
Return values
int —getState()
public
getState() : int
Return values
int —handlePacket()
public
handlePacket(Packet $packet) : void
Parameters
- $packet : Packet
Return values
void —initiateDisconnect()
Initiates a graceful asynchronous disconnect which ensures both parties got all packets.
public
initiateDisconnect(string $reason) : void
Parameters
- $reason : string
Return values
void —isConnected()
public
isConnected() : bool
Return values
bool —isFullyDisconnected()
Returns whether the session is ready to be destroyed (either properly cleaned up or forcibly terminated)
public
isFullyDisconnected() : bool
Return values
bool —isTemporal()
public
isTemporal() : bool
Return values
bool —update()
public
update(float $time) : void
Parameters
- $time : float
Return values
void —handleEncapsulatedPacketRoute()
private
handleEncapsulatedPacketRoute(EncapsulatedPacket $packet) : void
Parameters
- $packet : EncapsulatedPacket
Return values
void —handlePong()
private
handlePong(int $sendPingTime, int $sendPongTime) : void
Parameters
- $sendPingTime : int
- $sendPongTime : int
-
TODO: clock differential stuff
Return values
void —onClientDisconnect()
private
onClientDisconnect() : void
Return values
void —queueConnectedPacket()
private
queueConnectedPacket(ConnectedPacket $packet, int $reliability, int $orderChannel[, bool $immediate = false ]) : void
Parameters
- $packet : ConnectedPacket
- $reliability : int
- $orderChannel : int
- $immediate : bool = false
Return values
void —sendPacket()
private
sendPacket(Packet $packet) : void
Parameters
- $packet : Packet
Return values
void —sendPing()
private
sendPing([int $reliability = PacketReliability::UNRELIABLE ]) : void
Parameters
- $reliability : int = PacketReliability::UNRELIABLE