From 3a73e8d095ebea00dca5e32575e2eb7fc6aeb975 Mon Sep 17 00:00:00 2001 From: Pawel Wasowski Date: Mon, 8 May 2017 13:14:33 +0200 Subject: [PATCH] [Convergence] Fix SVACE issue BUG WGID: 174706, WID: 22870047 [Verification] Code compiles Change-Id: I03b1535f85a22d84aef244b4dc5a872e4d9a9ab7 --- src/convergence/convergence_instance.cc | 8 ++++---- src/convergence/convergence_service.cc | 5 ----- src/convergence/convergence_service.h | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/convergence/convergence_instance.cc b/src/convergence/convergence_instance.cc index c00109b2..86343755 100644 --- a/src/convergence/convergence_instance.cc +++ b/src/convergence/convergence_instance.cc @@ -453,7 +453,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceStart(const pico auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel); std::vector::iterator channel_it = service->GetChannel(channel_arg); - if (service->IsChannelStarted(channel_it)) { + if (service->opened_channels.end() != channel_it) { result = LogAndCreateTizenError(InvalidStateError, "Service is already started for the channel.", ("Service is already started for the channel.")); } else { @@ -505,7 +505,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceSend(const picoj auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel); std::vector::iterator channel_it = service->GetChannel(channel_arg); - if (!service->IsChannelStarted(channel_it)) { + if (service->opened_channels.end() == channel_it) { result = LogAndCreateTizenError(InvalidStateError, "Service is not started for the channel.", ("Service is not started for the channel.")); } else { @@ -556,7 +556,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceStop(const picoj auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel); std::vector::iterator channel_it = service->GetChannel(channel_arg); - if (!service->IsChannelStarted(channel_it)) { + if (service->opened_channels.end() == channel_it) { result = LogAndCreateTizenError(InvalidStateError, "Service is not started for the channel.", ("Service is not started for the channel.")); } else { @@ -609,7 +609,7 @@ common::TizenResult ConvergenceInstance::AppCommunicationServiceGetClientList(co auto channel_arg = ConvergenceUtils::GetArg(args, kJSArgumentChannel); std::vector::iterator channel_it = service->GetChannel(channel_arg); - if (!service->IsChannelStarted(channel_it)) { + if (service->opened_channels.end() == channel_it) { result = LogAndCreateTizenError(InvalidStateError, "Service is not started for the channel.", ("Service is not started for the channel.")); } else { diff --git a/src/convergence/convergence_service.cc b/src/convergence/convergence_service.cc index 29992d7b..f2b2bbe2 100644 --- a/src/convergence/convergence_service.cc +++ b/src/convergence/convergence_service.cc @@ -203,11 +203,6 @@ std::vector::iterator ConvergenceService::GetChannel(const return opened_channels.end(); } -bool ConvergenceService::IsChannelStarted(std::vector::iterator it) { - ScopeLogger(); - return it != opened_channels.end(); -} - void ConvergenceService::RemoveChannel(std::vector::iterator it) { ScopeLogger(); opened_channels.erase(it); diff --git a/src/convergence/convergence_service.h b/src/convergence/convergence_service.h index 42ff0a65..9f4b4e45 100644 --- a/src/convergence/convergence_service.h +++ b/src/convergence/convergence_service.h @@ -46,13 +46,13 @@ class ConvergenceService { public: void Refresh(); std::vector::iterator GetChannel(const picojson::value &channel_json); - bool IsChannelStarted(std::vector::iterator); void RemoveChannel(std::vector::iterator); public: //conv_service_e get_type() const { return type_; } //conv_device_h get_device() const {return device_; } picojson::value ToJson() const; + std::vector opened_channels; protected: conv_service_h FindServiceHandle() const; @@ -68,7 +68,6 @@ class ConvergenceService { conv_device_h device_; // TODO rename to device_handle_ conv_service_e type_; mutable conv_service_h service_handle_; - std::vector opened_channels; friend class ConvergenceAppCommunicationServerService; // It is needed to register the local service private: conv_service_connection_state_e connection_state_; -- 2.34.1