From b88bddb76bdb7c471b348c05f7b8feb96b6cdc4e Mon Sep 17 00:00:00 2001 From: beu Date: Thu, 3 Mar 2022 20:04:02 +0100 Subject: [PATCH] Fix Communication Manager --- core/Communication/CommunicationManager.php | 4 ++-- libs/React/Socket/Server.php | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/Communication/CommunicationManager.php b/core/Communication/CommunicationManager.php index 5eb5dcaa..2f67d643 100644 --- a/core/Communication/CommunicationManager.php +++ b/core/Communication/CommunicationManager.php @@ -296,9 +296,9 @@ class CommunicationManager implements CallbackListener, UsageInformationAble { }); }); //TODO check if port is closed - $this->socket->listen($socketPort, $this->maniaControl->getServer()->ip); + $this->socket->listen($socketPort, $socketHost); - Logger::log("[CommunicationManager] Socket " . $this->maniaControl->getServer()->ip . ":" . $this->socket->getPort() . " Successfully created!"); + Logger::log("[CommunicationManager] Socket " . $this->socket->getHost() . ":" . $this->socket->getPort() . " Successfully created!"); } catch (ConnectionException $e) { Logger::log("[CommunicationManager] Exception: " . $e->getMessage()); } diff --git a/libs/React/Socket/Server.php b/libs/React/Socket/Server.php index 98a0a835..484140c2 100644 --- a/libs/React/Socket/Server.php +++ b/libs/React/Socket/Server.php @@ -50,6 +50,13 @@ class Server extends EventEmitter implements ServerInterface $this->emit('connection', array($client)); } + public function getHost() + { + $name = stream_socket_get_name($this->master, false); + + return (int) substr(strrchr($name, ':'), 0); + } + public function getPort() { $name = stream_socket_get_name($this->master, false);