diff options
author | Philip Rauwolf <rauwolf@itestra.de> | 2013-02-28 19:09:36 +0100 |
---|---|---|
committer | Philip Rauwolf <rauwolf@itestra.de> | 2013-02-28 19:09:36 +0100 |
commit | 8163ace5ed58e8c84f864be5d26afb8179ef8956 (patch) | |
tree | 8c42cf2e24d772100772cd1af22045695dfd472d | |
parent | f092336493b3ce4e2b58d7a37eded5bc4b44b4c2 (diff) | |
download | genivi-common-api-runtime-8163ace5ed58e8c84f864be5d26afb8179ef8956.tar.gz |
Deinitialization of running services now working
-rw-r--r-- | src/CommonAPI/Factory.h | 8 | ||||
-rw-r--r-- | src/CommonAPI/Stub.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/CommonAPI/Factory.h b/src/CommonAPI/Factory.h index c07945d..bacda21 100644 --- a/src/CommonAPI/Factory.h +++ b/src/CommonAPI/Factory.h @@ -134,7 +134,13 @@ class Factory { } inline bool unregisterService(const std::string& serviceAddress) { - return registeredServices_.erase(serviceAddress); + auto foundStubAdapter = registeredServices_.find(serviceAddress); + if(foundStubAdapter != registeredServices_.end()) { + std::shared_ptr<CommonAPI::StubAdapter> stubAdapter = foundStubAdapter->second; + stubAdapter->deinit(); + return registeredServices_.erase(serviceAddress); + } + return false; } virtual std::vector<std::string> getAvailableServiceInstances(const std::string& serviceName, const std::string& serviceDomainName = "local") = 0; diff --git a/src/CommonAPI/Stub.h b/src/CommonAPI/Stub.h index 7353f54..740cc7a 100644 --- a/src/CommonAPI/Stub.h +++ b/src/CommonAPI/Stub.h @@ -21,6 +21,8 @@ class StubAdapter { virtual const std::string& getDomain() const = 0; virtual const std::string& getServiceId() const = 0; virtual const std::string& getInstanceId() const = 0; + + virtual void deinit() = 0; }; struct StubBase { @@ -37,6 +39,7 @@ class Stub : public StubBase { virtual ~Stub() { } virtual _StubRemoteEventHandler* initStubAdapter(const std::shared_ptr<_StubAdapter>& stubAdapter) = 0; + virtual void deinitStubAdapter() = 0; }; } // namespace CommonAPI |