diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-14 01:03:31 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-14 01:05:18 +0100 |
commit | 832af5ce93a52125328a580cec7aa6a17994f5c6 (patch) | |
tree | 7b88f4b793500bdc480c147346e14e9bf6aa28bd | |
parent | Defend against and don't make calls to open with O_CREAT set when re-establis... (diff) | |
download | netfs-832af5ce93a52125328a580cec7aa6a17994f5c6.tar.bz2 netfs-832af5ce93a52125328a580cec7aa6a17994f5c6.tar.xz netfs-832af5ce93a52125328a580cec7aa6a17994f5c6.zip |
The communicator you get at create isn't the one you get at start and doesn't have propertiesnetfs-1.1.2
-rw-r--r-- | netfs/daemon/daemon.cpp | 14 | ||||
-rw-r--r-- | netfs/daemon/daemon.h | 4 | ||||
-rw-r--r-- | netfs/unittests/testCore.cpp | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/netfs/daemon/daemon.cpp b/netfs/daemon/daemon.cpp index 3ad6294..f703386 100644 --- a/netfs/daemon/daemon.cpp +++ b/netfs/daemon/daemon.cpp @@ -8,14 +8,15 @@ #include "ioHelpers.h" #include <sys/stat.h> -NetFSDaemon::NetFSDaemon(const Ice::CommunicatorPtr & i) : - ic(i) +NetFSDaemon::NetFSDaemon() { } NetFSDaemon::~NetFSDaemon() { - adapter->deactivate(); + if (adapter) { + adapter->deactivate(); + } } std::string @@ -33,8 +34,9 @@ NetFSDaemon::hostname() // name = NetFSDaemonAdapter void -NetFSDaemon::start(const std::string & name, const Ice::CommunicatorPtr &, const Ice::StringSeq&) +NetFSDaemon::start(const std::string & name, const Ice::CommunicatorPtr & ic, const Ice::StringSeq&) { + this->ic = ic; Ice::PropertiesPtr props = ic->getProperties(); LoadConfiguration(props->getProperty("NetFSD.ConfigPath")); @@ -69,9 +71,9 @@ NetFSDaemon::stop() extern "C" { IceBox::Service * - createNetFSDaemon(Ice::CommunicatorPtr ic) + createNetFSDaemon(Ice::CommunicatorPtr) { - return new NetFSDaemon(ic); + return new NetFSDaemon(); } } diff --git a/netfs/daemon/daemon.h b/netfs/daemon/daemon.h index 7ed5cb4..1cf2d49 100644 --- a/netfs/daemon/daemon.h +++ b/netfs/daemon/daemon.h @@ -9,7 +9,7 @@ class NetFSDaemon : public IceBox::Service { public: - NetFSDaemon(const Ice::CommunicatorPtr &); + NetFSDaemon(); virtual ~NetFSDaemon(); virtual void start(const std::string&, const Ice::CommunicatorPtr&, const Ice::StringSeq&) override; @@ -21,7 +21,7 @@ class NetFSDaemon : public IceBox::Service { private: void LoadConfiguration(const boost::filesystem::path & path); - const Ice::CommunicatorPtr ic; + Ice::CommunicatorPtr ic; Ice::ObjectAdapterPtr adapter; NetFS::Daemon::RuntimeConfigurationPtr dc; diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index 1fc1817..02405d9 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -20,7 +20,7 @@ std::string testEndpoint("tcp -h localhost -p 12012"); class MockDaemon : public NetFSDaemon { public: - MockDaemon(const Ice::CommunicatorPtr & ic) : NetFSDaemon(ic) { } + MockDaemon() : NetFSDaemon() { } protected: virtual NetFS::Daemon::ConfigurationPtr ReadConfiguration(const boost::filesystem::path &) const override @@ -40,7 +40,7 @@ class MockDaemonHost { MockDaemonHost() : params({}), ic(Ice::initialize(params)), - daemon(new MockDaemon(ic)) + daemon(new MockDaemon()) { ic->getProperties()->setProperty("NetFSD.HostNameOverride", "unittest"); daemon->start("NetFSDaemonAdapter", ic, {}); |