From 924ab01e88197afcef434c4e9dac36aca1879cdc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 28 Oct 2020 08:35:41 +0100 Subject: [PATCH] Continued: - activated own exception handler - ASSERT_WARNING enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../hub/classes/dht/node/class_NodeDhtFacade.php | 13 ++++--------- application/hub/exceptions.php | 4 ++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php index 66f7ba1d6..fd25b163b 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -229,23 +229,18 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { */ public function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, $forceUpdate = FALSE) { // Get a search criteria class + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageData()=%d,handlerInstance=%s,forceUpdate=%d - CALLED', $this->getPrintableState(), count($messageData), $handlerInstance->__toString(), intval($forceUpdate))); $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-FACADE: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE) . ',handlerInstance=' . $handlerInstance->__toString() . ',forceUpdate=' . intval($forceUpdate) . ',count(getSearchData())=' . count($handlerInstance->getSearchData())); - // Search for the node's session id and external address/hostname + TCP/UDP listen port + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: handlerInstance->searchData()=%d', count($handlerInstance->getSearchData()))); foreach ($handlerInstance->getSearchData() as $key) { - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-FACADE: state=' . $this->getPrintableState() . ',key=' . $key); - // Is it there? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,key=%s', $this->getPrintableState(), $key)); assert(isset($messageData[$key])); - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-FACADE: state=' . $this->getPrintableState() . ',messageData[' . $key . ']=' . $messageData[$key]); - // Add criteria + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageData[%s]=%s', $this->getPrintableState(), $key, $messageData[$key])); $searchInstance->addCriteria(str_replace('my-', '', $key), $messageData[$key]); } // END - foreach diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php index 5fcd0be2b..1b74a7286 100644 --- a/application/hub/exceptions.php +++ b/application/hub/exceptions.php @@ -137,14 +137,14 @@ function hub_assert_handler ($file, $line, $code) { } // END - function // Set error handler -//set_error_handler('hub_error_handler'); +set_error_handler('hub_error_handler'); // Set the new handler set_exception_handler('hub_exception_handler'); // Init assert handling assert_options(ASSERT_ACTIVE , true); -assert_options(ASSERT_WARNING , false); +assert_options(ASSERT_WARNING , true); assert_options(ASSERT_BAIL , true); assert_options(ASSERT_QUIET_EVAL, false); assert_options(ASSERT_CALLBACK , 'hub_assert_handler'); -- 2.39.5