summaryrefslogtreecommitdiffstats
path: root/filedistribution
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-09-13 22:17:52 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-09-14 09:17:01 +0000
commit18518bb0854e4259b4b3b3f9801c66d71af08564 (patch)
tree22e820256a2af4a7e2d170fd3f4b5ff354d0ad89 /filedistribution
parent0a997bd0849320c20f40746acbcef30c2ad1b83d (diff)
Track foreign
Diffstat (limited to 'filedistribution')
-rw-r--r--filedistribution/src/apps/filedistributor/filedistributor.cpp9
-rw-r--r--filedistribution/src/vespa/filedistribution/common/componentsdeleter.h13
-rw-r--r--filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.cpp6
-rw-r--r--filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h5
-rw-r--r--filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.cpp4
-rw-r--r--filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.h4
-rw-r--r--filedistribution/src/vespa/filedistribution/rpc/fileprovider.h2
7 files changed, 12 insertions, 31 deletions
diff --git a/filedistribution/src/apps/filedistributor/filedistributor.cpp b/filedistribution/src/apps/filedistributor/filedistributor.cpp
index 5fb19d38138..010fe71733e 100644
--- a/filedistribution/src/apps/filedistributor/filedistributor.cpp
+++ b/filedistribution/src/apps/filedistributor/filedistributor.cpp
@@ -65,11 +65,6 @@ class FileDistributor : public config::IFetcherCallback<ZookeepersConfig>,
return _componentsDeleter.track(component);
}
- template <class T>
- typename boost::shared_ptr<T> track_boost(T* component) {
- return _componentsDeleter.track_boost(component);
- }
-
public:
Components(const Components &) = delete;
Components & operator = (const Components &) = delete;
@@ -90,8 +85,8 @@ class FileDistributor : public config::IFetcherCallback<ZookeepersConfig>,
fileDistributorConfig.hostname,
fileDistributorConfig.torrentport,
boost::filesystem::path(fileDistributorConfig.filedbpath)))),
- _manager(track_boost(new FileDownloaderManager(_downloader, _model))),
- _rpcHandler(track_boost(new FileDistributorRPC(rpcConfig.connectionspec, _manager))),
+ _manager(track(new FileDownloaderManager(_downloader, _model))),
+ _rpcHandler(track(new FileDistributorRPC(rpcConfig.connectionspec, _manager))),
_stateServer(track(new StateServerImpl(fileDistributorConfig.stateport))),
_downloaderEventLoopThread(std::bind(&FileDownloader::runEventLoop, _downloader.get())),
_configFetcher(configUri.getContext())
diff --git a/filedistribution/src/vespa/filedistribution/common/componentsdeleter.h b/filedistribution/src/vespa/filedistribution/common/componentsdeleter.h
index 36ed77fc719..e7086f87333 100644
--- a/filedistribution/src/vespa/filedistribution/common/componentsdeleter.h
+++ b/filedistribution/src/vespa/filedistribution/common/componentsdeleter.h
@@ -7,8 +7,6 @@
#include <mutex>
#include <thread>
-#include <boost/smart_ptr.hpp>
-
#include "concurrentqueue.h"
namespace filedistribution {
@@ -60,17 +58,6 @@ class ComponentsDeleter {
~ComponentsDeleter();
template <class T>
- boost::shared_ptr<T> track_boost(T* t) {
- LockGuard guard(_trackedComponentsMutex);
- if (_closed) {
- return boost::shared_ptr<T>(t);
- }
-
- _trackedComponents[t] = typeid(t).name();
- return boost::shared_ptr<T>(t, std::bind(&ComponentsDeleter::requestDelete<T>, this, t));
- }
-
- template <class T>
std::shared_ptr<T> track(T* t) {
LockGuard guard(_trackedComponentsMutex);
if (_closed) {
diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.cpp b/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.cpp
index 5590a52fe6b..53cc26ecff4 100644
--- a/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.cpp
+++ b/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.cpp
@@ -44,17 +44,17 @@ FileDownloaderManager::start()
_downloadFailedConnection =
downloadFailed().connect(
DownloadFailedSignal::slot_type(std::bind(&FileDownloaderManager::removePeerStatus, this, ph::_1)).
- track(shared_from_this()));
+ track_foreign(shared_from_this()));
_downloadCompletedConnection =
downloadCompleted().connect(
DownloadCompletedSignal::slot_type(_setFinishedDownloadingStatus).
- track(shared_from_this()));
+ track_foreign(shared_from_this()));
_filesToDownloadChangedConnection =
_fileDistributionModel->_filesToDownloadChanged.connect(
FileDistributionModel::FilesToDownloadChangedSignal::slot_type(std::ref(_startDownloads)).
- track(shared_from_this()));
+ track_foreign(shared_from_this()));
}
boost::optional< boost::filesystem::path >
diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h b/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h
index f6047f66b95..1294f7d7f77 100644
--- a/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h
+++ b/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h
@@ -5,13 +5,12 @@
#include <vespa/filedistribution/rpc/fileprovider.h>
#include <vespa/filedistribution/model/filedistributionmodel.h>
-#include <boost/enable_shared_from_this.hpp>
#include "filedownloader.h"
namespace filedistribution {
class FileDownloaderManager : public FileProvider,
- public boost::enable_shared_from_this<FileDownloaderManager> {
+ public std::enable_shared_from_this<FileDownloaderManager> {
class StartDownloads {
FileDownloaderManager& _parent;
@@ -42,7 +41,7 @@ class FileDownloaderManager : public FileProvider,
void removePeerStatus(const std::string& fileReference);
public:
- using SP = boost::shared_ptr<FileDownloaderManager>;
+ using SP = std::shared_ptr<FileDownloaderManager>;
FileDownloaderManager(const FileDownloaderManager &) = delete;
FileDownloaderManager & operator = (const FileDownloaderManager &) = delete;
FileDownloaderManager(const std::shared_ptr<FileDownloader>&,
diff --git a/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.cpp b/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.cpp
index ed31aebbaf9..fa289ad4705 100644
--- a/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.cpp
+++ b/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.cpp
@@ -188,12 +188,12 @@ FileDistributorRPC::Server::start(const FileDistributorRPC::SP & parent) {
_downloadCompletedConnection =
_fileProvider->downloadCompleted().connect(FileProvider::DownloadCompletedSignal::slot_type(
std::bind(&QueuedRequests::downloadFinished, &_queuedRequests, ph::_1, ph::_2)).
- track(parent));
+ track_foreign(parent));
_downloadFailedConnection =
_fileProvider->downloadFailed().connect(FileProvider::DownloadFailedSignal::slot_type(
std::bind(&QueuedRequests::downloadFailed, &_queuedRequests, ph::_1, ph::_2)).
- track(parent));
+ track_foreign(parent));
}
diff --git a/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.h b/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.h
index ee8f9ddef24..3c780bf5878 100644
--- a/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.h
+++ b/filedistribution/src/vespa/filedistribution/rpc/filedistributorrpc.h
@@ -8,11 +8,11 @@
namespace filedistribution {
-class FileDistributorRPC : public boost::enable_shared_from_this<FileDistributorRPC>
+class FileDistributorRPC : public std::enable_shared_from_this<FileDistributorRPC>
{
class Server;
public:
- using SP = boost::shared_ptr<FileDistributorRPC>;
+ using SP = std::shared_ptr<FileDistributorRPC>;
FileDistributorRPC(const FileDistributorRPC &) = delete;
FileDistributorRPC & operator = (const FileDistributorRPC &) = delete;
FileDistributorRPC(const std::string& connectSpec, const FileProvider::SP & provider);
diff --git a/filedistribution/src/vespa/filedistribution/rpc/fileprovider.h b/filedistribution/src/vespa/filedistribution/rpc/fileprovider.h
index f8b3e1fcf1b..4eeeee5e359 100644
--- a/filedistribution/src/vespa/filedistribution/rpc/fileprovider.h
+++ b/filedistribution/src/vespa/filedistribution/rpc/fileprovider.h
@@ -10,7 +10,7 @@ namespace filedistribution {
class FileProvider
{
public:
- using SP = boost::shared_ptr<FileProvider>;
+ using SP = std::shared_ptr<FileProvider>;
typedef boost::signals2::signal<void (const std::string& /* fileReference */,
const boost::filesystem::path&)>
DownloadCompletedSignal;