NetworkSession: added getHandler() and setHandler(), SessionHandler->setUp() now not useless

This commit is contained in:
Dylan K. Taylor 2018-07-19 16:40:00 +01:00
parent 08621604cd
commit e16f20affa

View File

@ -60,7 +60,7 @@ class NetworkSession{
$this->ip = $ip; $this->ip = $ip;
$this->port = $port; $this->port = $port;
$this->handler = new SimpleSessionHandler($player); $this->setHandler(new SimpleSessionHandler($player));
} }
public function getInterface() : NetworkInterface{ public function getInterface() : NetworkInterface{
@ -81,6 +81,15 @@ class NetworkSession{
return $this->port; return $this->port;
} }
public function getHandler() : SessionHandler{
return $this->handler;
}
public function setHandler(SessionHandler $handler) : void{
$this->handler = $handler;
$this->handler->setUp();
}
public function handleEncoded(string $payload) : void{ public function handleEncoded(string $payload) : void{
//TODO: decryption if enabled //TODO: decryption if enabled