lib/ext

Aleksander Machniak machniak at kolabsys.com
Mon Oct 28 12:42:39 CET 2013


 lib/ext/Syncroton/Command/Ping.php |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 43243aef42cd4361f4ace045dcf4825f19a9c8a2
Author: Aleksander Machniak <alec at alec.pl>
Date:   Mon Oct 28 12:42:02 2013 +0100

    Fix unhandled exception in Ping command (Bug #2388)

diff --git a/lib/ext/Syncroton/Command/Ping.php b/lib/ext/Syncroton/Command/Ping.php
index 08ad41f..d2e5c83 100644
--- a/lib/ext/Syncroton/Command/Ping.php
+++ b/lib/ext/Syncroton/Command/Ping.php
@@ -102,15 +102,27 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
             $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " Folders to monitor($lifeTime / $intervalStart / $intervalEnd / $status): " . print_r($folders, true));
         
         if ($status === self::STATUS_NO_CHANGES_FOUND) {
-
-            $folderWithChanges = array();
-            
             do {
                 // take a break to save battery lifetime
                 sleep(Syncroton_Registry::getPingTimeout());
 
+                try {
+                    $device = $this->_deviceBackend->get($this->_device->id);
+                } catch (Syncroton_Exception_NotFound $e) {
+                    if ($this->_logger instanceof Zend_Log)
+                        $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+
+                    $status = self::STATUS_FOLDER_NOT_FOUND;
+                    break;
+                } catch (Exception $e) {
+                    if ($this->_logger instanceof Zend_Log)
+                        $this->_logger->err(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+
+                    // do nothing, maybe temporal issue, should we stop?
+                    continue;
+                }
+
                 // if another Ping command updated lastping property, we can stop processing this Ping command request
-                $device = $this->_deviceBackend->get($this->_device->id);
                 if ((isset($device->lastping) && $device->lastping instanceof DateTime) &&
                     $device->pingfolder === $this->_device->pingfolder &&
                     $device->lastping->getTimestamp() > $this->_device->lastping->getTimestamp() ) {




More information about the commits mailing list