diff options
| author | Tobias Markmann <tm@ayena.de> | 2016-01-14 10:05:25 (GMT) | 
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2016-01-15 14:23:50 (GMT) | 
| commit | f690e1de6f97305c89cf90afb4305487a9c6fc2e (patch) | |
| tree | 86a7ed0c3eca883d30842f411ad23e335c7b222d | |
| parent | 730a9d26ef340373796aeb020175fce0ed716865 (diff) | |
| download | swift-f690e1de6f97305c89cf90afb4305487a9c6fc2e.zip swift-f690e1de6f97305c89cf90afb4305487a9c6fc2e.tar.bz2 | |
Free file-transfer objects before removing files in QA tool
FileTransferTest would attempt to remove files while the
file-transfer objects still have a file handle open to them
in form of FileReadBytestream and FileWriteBytestream
references.
Test-Information:
./scons test=system Swiften/QA/FileTransferTest passed
successfully on Windows 8.
Change-Id: Iba45fa5df7e6f55667dd76fee4624733bb363fe5
| -rw-r--r-- | Swiften/QA/FileTransferTest/FileTransferTest.cpp | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp index 2dcaeb8..13b6eff 100644 --- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp +++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp @@ -1,5 +1,5 @@  /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited.   * All rights reserved.   * See the COPYING file for more information.   */ @@ -75,8 +75,8 @@ class FileTransferTest {  			timeOut_->onTick.connect(boost::bind(&FileTransferTest::handleTimeOut, this));  			// Create randomly sized data to exchange. -			sendFilePath_ = boost::filesystem::unique_path(); -			receiveFilePath_ = boost::filesystem::unique_path(); +			sendFilePath_ = boost::filesystem::unique_path("ft_send_%%%%%%%%%%%%%%%%.bin"); +			receiveFilePath_ = boost::filesystem::unique_path("ft_receive_%%%%%%%%%%%%%%%%.bin");  			size_t size = 1024 + boost::numeric_cast<size_t>(randGen.generateRandomInteger(1024 * 10));  			sendData_.resize(size); @@ -95,6 +95,10 @@ class FileTransferTest {  			delete senderTracer_;  			delete receiverTracer_; +			// Free file-transfer objects so file handles are closed and files can be removed afterwards. +			incomingFileTransfers_.clear(); +			outgoingFileTransfer_.reset(); +  			if(boost::filesystem::exists(sendFilePath_)) {  				boost::filesystem::remove(sendFilePath_);  			} | 
 Swift
 Swift