[Pkg-owncloud-commits] [owncloud-client] 16/70: Propagator: Handle file open error properly and log error message.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Jul 1 10:21:18 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 2d234cd96f92cd633d48ad5b73ba054b8d0879ee
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Mon Jun 16 13:35:50 2014 +0200

    Propagator: Handle file open error properly and log error message.
---
 src/mirall/propagator_qnam.cpp | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/mirall/propagator_qnam.cpp b/src/mirall/propagator_qnam.cpp
index f869e30..589f6b8 100644
--- a/src/mirall/propagator_qnam.cpp
+++ b/src/mirall/propagator_qnam.cpp
@@ -200,7 +200,7 @@ void PropagateUploadFileQNAM::startNextChunk()
     }
 
     QString path = _item._file;
-    QIODevice *device;
+    QIODevice *device = 0;
     if (_chunkCount > 1) {
         int sendingChunk = (_currentChunk + _startChunk) % _chunkCount;
         // XOR with chunk size to make sure everything goes well if chunk size change between runs
@@ -218,14 +218,25 @@ void PropagateUploadFileQNAM::startNextChunk()
     } else {
         device = _file;
     }
-    if (!device->isOpen())
-        device->open(QIODevice::ReadOnly);
 
-    _job = new PUTFileJob(AccountManager::instance()->account(), _propagator->_remoteFolder + path, device, headers);
-    _job->setTimeout(_propagator->httpTimeout() * 1000);
-    connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished()));
-    connect(_job, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
-    _job->start();
+    bool isOpen = true;
+    if (!device->isOpen()) {
+        isOpen = device->open(QIODevice::ReadOnly);
+    }
+
+    if( isOpen ) {
+        _job = new PUTFileJob(AccountManager::instance()->account(), _propagator->_remoteFolder + path, device, headers);
+        _job->setTimeout(_propagator->httpTimeout() * 1000);
+        connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished()));
+        connect(_job, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
+        _job->start();
+    } else {
+        delete device;
+
+        qDebug() << "ERR: Could not open upload file: " << device->errorString();
+        done( SyncFileItem::NormalError, device->errorString() );
+        return;
+    }
 }
 
 void PropagateUploadFileQNAM::slotPutFinished()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list