From 7e176d7bc1f752de5c7d7443e9ff062c62c70d54 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 11 Sep 2021 11:47:26 +1000 Subject: [PATCH] Fix for unknown FTN when connection is not established, try and catch unknown socket exception during session initialisation --- app/Classes/Protocol.php | 2 +- app/Classes/Sock/SocketServer.php | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Classes/Protocol.php b/app/Classes/Protocol.php index d71dcde..66bf314 100644 --- a/app/Classes/Protocol.php +++ b/app/Classes/Protocol.php @@ -304,7 +304,7 @@ abstract class Protocol Log::info(sprintf('%s: Total: %s - %d:%02d:%02d online, (%d) %lu%s sent, (%d) %lu%s received - %s', self::LOGKEY, - $this->node->address->ftn, + $this->node->address ? $this->node->address->ftn : 'Unknown', $this->node->session_time/3600, $this->node->session_time%3600/60, $this->node->session_time%60, diff --git a/app/Classes/Sock/SocketServer.php b/app/Classes/Sock/SocketServer.php index 2930722..9422ff7 100644 --- a/app/Classes/Sock/SocketServer.php +++ b/app/Classes/Sock/SocketServer.php @@ -100,7 +100,15 @@ final class SocketServer { if (($accept = socket_accept($this->server)) === FALSE) throw new SocketException(SocketException::CANT_ACCEPT,socket_strerror(socket_last_error($this->server))); - $this->handler[0]->{$this->handler[1]}(new SocketClient($accept)); + try { + $r = new SocketClient($accept); + + } catch (\ErrorException $e) { + Log::error(sprintf('%s:! Creating Socket client failed? [%s]',self::LOGKEY,$e->getMessage())); + continue; + } + + $this->handler[0]->{$this->handler[1]}($r); } }