From 221dc637c0caed7ff81928d7202bf61f6e24f239 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 19 May 2017 23:30:46 +0200 Subject: [PATCH] Continued with rewrite of sockets: - imported BaseListener MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../hub/classes/factories/socket/class_SocketFactory.php | 3 ++- application/hub/classes/handler/network/tcp/class_ | 1 + application/hub/classes/listener/tcp/class_ | 1 + application/hub/classes/listener/tcp/class_TcpListener.php | 1 + application/hub/classes/listener/udp/class_ | 1 + application/hub/classes/listener/udp/class_UdpListener.php | 3 +++ application/hub/classes/pools/peer/class_DefaultPeerPool.php | 2 +- .../hub/classes/registry/socket/class_SocketRegistry.php | 1 + .../classes/resolver/state/peer/class_PeerStateResolver.php | 2 +- 9 files changed, 12 insertions(+), 3 deletions(-) diff --git a/application/hub/classes/factories/socket/class_SocketFactory.php b/application/hub/classes/factories/socket/class_SocketFactory.php index 6b7c86b57..8e657c6cd 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -3,6 +3,7 @@ namespace Hub\Factory\Socket; // Import application-specific stuff +use Hub\Listener\BaseListener; use Hub\Network\Package\NetworkPackage; // Import framework stuff @@ -132,7 +133,7 @@ class SocketFactory extends ObjectFactory { // Is the socket resource valid? if (!$socketInstance->isValidSocket()) { // Something bad happened - throw new InvalidSocketException(array($listenerInstance, $socketInstance), BaseListener::EXCEPTION_INVALID_SOCKET); + throw new InvalidSocketException(array($listenerInstance, $socketInstance->getSocketResource()), BaseListener::EXCEPTION_INVALID_SOCKET); } // END - if // Get socket error code for verification diff --git a/application/hub/classes/handler/network/tcp/class_ b/application/hub/classes/handler/network/tcp/class_ index c4413218d..27e450087 100644 --- a/application/hub/classes/handler/network/tcp/class_ +++ b/application/hub/classes/handler/network/tcp/class_ @@ -138,6 +138,7 @@ namespace Hub\Listener\; // Import application-specific stuff use Hub\Helper\Node\NodeHelper; +use Hub\Listener\BaseListener; // Import framework stuff use CoreFramework\Listener\Listenable; diff --git a/application/hub/classes/listener/tcp/class_ b/application/hub/classes/listener/tcp/class_ index c2a49dcce..2f6778016 100644 --- a/application/hub/classes/listener/tcp/class_ +++ b/application/hub/classes/listener/tcp/class_ @@ -137,6 +137,7 @@ namespace Hub\Listener\Tcp\; // Import application-specific stuff use Hub\Helper\Node\NodeHelper; +use Hub\Listener\BaseListener; // Import framework stuff use CoreFramework\Listener\Listenable; diff --git a/application/hub/classes/listener/tcp/class_TcpListener.php b/application/hub/classes/listener/tcp/class_TcpListener.php index 68fb1a8be..a5182f89e 100644 --- a/application/hub/classes/listener/tcp/class_TcpListener.php +++ b/application/hub/classes/listener/tcp/class_TcpListener.php @@ -4,6 +4,7 @@ namespace Hub\Listener\Tcp; // Import application-specific stuff use Hub\Helper\Connection\BaseConnectionHelper; +use Hub\Listener\BaseListener; // Import framework stuff use CoreFramework\Factory\ObjectFactory; diff --git a/application/hub/classes/listener/udp/class_ b/application/hub/classes/listener/udp/class_ index 465876547..c14d4b227 100644 --- a/application/hub/classes/listener/udp/class_ +++ b/application/hub/classes/listener/udp/class_ @@ -4,6 +4,7 @@ namespace Hub\Listener\Udp\; // Import application-specific stuff use Hub\Helper\Node\NodeHelper; +use Hub\Listener\BaseListener; // Import framework stuff use CoreFramework\Listener\Listenable; diff --git a/application/hub/classes/listener/udp/class_UdpListener.php b/application/hub/classes/listener/udp/class_UdpListener.php index dcb0a0453..a713502a9 100644 --- a/application/hub/classes/listener/udp/class_UdpListener.php +++ b/application/hub/classes/listener/udp/class_UdpListener.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Listener\Udp; +// Import application-specific stuff +use Hub\Listener\BaseListener; + // Import framework stuff use CoreFramework\Factory\ObjectFactory; use CoreFramework\Listener\Listenable; diff --git a/application/hub/classes/pools/peer/class_DefaultPeerPool.php b/application/hub/classes/pools/peer/class_DefaultPeerPool.php index 995688906..1797f0e55 100644 --- a/application/hub/classes/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/classes/pools/peer/class_DefaultPeerPool.php @@ -74,7 +74,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { // Is it a valid resource? if (!$socketInstance->isValidSocket()) { // Throw an exception - throw new InvalidSocketException(array($this, $socketInstance), SocketHandler::EXCEPTION_INVALID_SOCKET); + throw new InvalidSocketException(array($this, $socketInstance->getSocketResource()), SocketHandler::EXCEPTION_INVALID_SOCKET); } // END - if // Get error code diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index 088da4a0b..d5d6079ca 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -6,6 +6,7 @@ namespace Hub\Registry\Socket; use Hub\Container\Socket\StorableSocket; use Hub\Factory\Information\Connection\ConnectionInfoFactory; use Hub\Information\ShareableInfo; +use Hub\Listener\BaseListener; use Hub\Network\Package\NetworkPackage; use Hub\Registry\Socket\RegisterableSocket; diff --git a/application/hub/classes/resolver/state/peer/class_PeerStateResolver.php b/application/hub/classes/resolver/state/peer/class_PeerStateResolver.php index c4241a05d..811224abd 100644 --- a/application/hub/classes/resolver/state/peer/class_PeerStateResolver.php +++ b/application/hub/classes/resolver/state/peer/class_PeerStateResolver.php @@ -84,7 +84,7 @@ class PeerStateResolver extends BaseStateResolver implements StateResolver { // Still no socket resource? if (!$socketInstance->isValidSocket())) { // Then abort here with an exception (may happen after socket_shutdown()) - throw new InvalidSocketException(array($helperInstance, $socketInstance, 'unknown', 'unknown'), SocketHandler::EXCEPTION_INVALID_SOCKET); + throw new InvalidSocketException(array($helperInstance, $socketInstance->getSocketResource()), SocketHandler::EXCEPTION_INVALID_SOCKET); } // END - if } // END - if -- 2.39.5