]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/statistics/connection/class_ConnectionStatisticsHelper.php
Updated 'core'.
[hub.git] / application / hub / main / statistics / connection / class_ConnectionStatisticsHelper.php
index 29e5df2d1395fe4780e4b747c3eb335bc25e822a..a624e8dd51b7c8a07760a5fed7eb22c2f85bf552 100644 (file)
@@ -5,7 +5,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  * @todo               Find an interface for hub helper
@@ -26,6 +26,7 @@
 class ConnectionStatisticsHelper extends BaseHubSystem {
        /**
         * Statistics array
+        * @TODO Add more protocols to use
         */
        private static $connectionStatistics = array(
                // Statistics for TCP connections
@@ -57,16 +58,16 @@ class ConnectionStatisticsHelper extends BaseHubSystem {
         * @return      $isExhausted            Whether the retry count has been reached
         */
        public static function isConnectRetryExhausted (ConnectionHelper $helperInstance) {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - ENTERED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - CALLED!');
                // Construct config entry
-               $configEntry = $helperInstance->getProtocol() . '_connect_retry_max';
+               $configEntry = $helperInstance->getProtocolName() . '_connect_retry_max';
 
                // Check it out
                $isExhausted = (
                        (
-                               isset(self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'])
+                               isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])
                        ) && (
-                               self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
+                               self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
                        )
                );
 
@@ -82,21 +83,21 @@ class ConnectionStatisticsHelper extends BaseHubSystem {
         * @return      void
         */
        public static function increaseConnectRetry (ConnectionHelper $helperInstance) {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - ENTERED!');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - CALLED!');
                // Is the counter there
-               if (!isset(self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'])) {
+               if (!isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])) {
                        // First attempt
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - FIRST!');
-                       self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'] = 1;
+                       self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] = 1;
                } else {
                        // Next attempt
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - INCREMENT!');
-                       self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count']++;
+                       self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count']++;
                }
 
                // Create/update 'last_update' for purging
                // @TODO last_update is not being used at the moment
-               self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['last_update'] = time();
+               self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['last_update'] = time();
        }
 }