diff options
author | ShobhitAd <adlakhashobhit@gmail.com> | 2018-12-07 15:06:59 -0500 |
---|---|---|
committer | ShobhitAd <adlakhashobhit@gmail.com> | 2018-12-07 15:06:59 -0500 |
commit | 74833b87441c0ae351a226a978907a834f737ca9 (patch) | |
tree | 119eb8d508dd8551044b6369a8fec9afa80ae703 /src | |
parent | b1ff805f9956b8c4da3c97368ab4ebbf3579c1a6 (diff) | |
download | sdl_core-74833b87441c0ae351a226a978907a834f737ca9.tar.gz |
Remove debug statements and style fix
Diffstat (limited to 'src')
11 files changed, 135 insertions, 140 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 44d9a4f903..b08a7c3428 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -808,7 +808,6 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() { void ApplicationManagerImpl::CollectCloudAppInformation() { LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_COLLECTCLOUDAPPINFO"); std::vector<std::string> cloud_app_id_vector; GetPolicyHandler().GetEnabledCloudApps(cloud_app_id_vector); std::vector<std::string>::iterator it = cloud_app_id_vector.begin(); @@ -831,16 +830,13 @@ void ApplicationManagerImpl::CollectCloudAppInformation() { pending_device_map_.insert( std::pair<std::string, std::string>(endpoint, *it)); - transport_manager::transport_adapter::CloudAppProperties properties - {endpoint, certificate, enabled, auth_token, cloud_transport_type, hybrid_app_preference}; - LOG4CXX_DEBUG(logger_, "CLOUD_APP_MGR: " << endpoint); - LOG4CXX_DEBUG(logger_, "ENDPOINT: " << properties.endpoint); - LOG4CXX_DEBUG(logger_, "ENABLED: " << properties.enabled); - LOG4CXX_DEBUG(logger_, "CERTIFICATE: " << properties.certificate); - LOG4CXX_DEBUG(logger_, "AUTH_TOKEN: " << properties.auth_token); - LOG4CXX_DEBUG(logger_, "TRANSPORT_TYPE: " << properties.cloud_transport_type); - LOG4CXX_DEBUG(logger_, "HYBRID: " << properties.hybrid_app_preference); - + transport_manager::transport_adapter::CloudAppProperties properties{ + endpoint, + certificate, + enabled, + auth_token, + cloud_transport_type, + hybrid_app_preference}; connection_handler().AddCloudAppDevice(*it, properties); } } diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index 5819b32f03..2f175f8acc 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -130,8 +130,10 @@ class ConnectionHandlerImpl void ConnectToAllDevices() OVERRIDE; - void AddCloudAppDevice(const std::string& policy_app_id, - const transport_manager::transport_adapter::CloudAppProperties cloud_properties) OVERRIDE; + void AddCloudAppDevice( + const std::string& policy_app_id, + const transport_manager::transport_adapter::CloudAppProperties + cloud_properties) OVERRIDE; void StartTransportManager() OVERRIDE; diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index 55134ebf5b..6f24ae226d 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -1323,16 +1323,10 @@ void ConnectionHandlerImpl::ConnectToAllDevices() { } } -void ConnectionHandlerImpl::AddCloudAppDevice(const std::string& policy_app_id, - const transport_manager::transport_adapter::CloudAppProperties cloud_properties) { - // LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_ADDCLOUDAPPDEVICE: " << cloud_properties.endpoint); - // LOG4CXX_DEBUG(logger_, "ENDPOINT: " << cloud_properties.endpoint); - // LOG4CXX_DEBUG(logger_, "ENABLED: " << cloud_properties.enabled); - // LOG4CXX_DEBUG(logger_, "CERTIFICATE: " << cloud_properties.certificate); - // LOG4CXX_DEBUG(logger_, "AUTH_TOKEN: " << cloud_properties.auth_token); - // LOG4CXX_DEBUG(logger_, "TRANSPORT_TYPE: " << cloud_properties.cloud_transport_type); - // LOG4CXX_DEBUG(logger_, "HYBRID: " << cloud_properties.hybrid_app_preference); - +void ConnectionHandlerImpl::AddCloudAppDevice( + const std::string& policy_app_id, + const transport_manager::transport_adapter::CloudAppProperties + cloud_properties) { transport_manager_.AddCloudDevice(cloud_properties); } diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index 81dd24447c..f6bf8aeeb5 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -103,8 +103,10 @@ class ConnectionHandler { virtual void ConnectToAllDevices() = 0; - virtual void AddCloudAppDevice(const std::string& policy_app_id, - const transport_manager::transport_adapter::CloudAppProperties cloud_properties ) = 0; + virtual void AddCloudAppDevice( + const std::string& policy_app_id, + const transport_manager::transport_adapter::CloudAppProperties + cloud_properties) = 0; /** * @brief Close the connection revoked by Policy diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h index fe5b708dd1..3ee6da653e 100644 --- a/src/components/include/transport_manager/transport_manager.h +++ b/src/components/include/transport_manager/transport_manager.h @@ -75,7 +75,9 @@ class TransportManager { **/ virtual int SearchDevices() = 0; - virtual void AddCloudDevice(const transport_manager::transport_adapter::CloudAppProperties cloud_properties) = 0; + virtual void AddCloudDevice( + const transport_manager::transport_adapter::CloudAppProperties + cloud_properties) = 0; /** * @brief Connect to all applications discovered on device. diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h index 4270afd25f..138f9ca895 100644 --- a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h +++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h @@ -64,7 +64,8 @@ class CloudWebsocketTransportAdapter : public TransportAdapterImpl { * @param app_id app ID string * @param properties New cloud app properties for the app */ - void SetAppCloudTransportConfig(std::string app_id, CloudAppProperties properties); + void SetAppCloudTransportConfig(std::string app_id, + CloudAppProperties properties); /** * @brief Get CloudTransportConfig for specified app_id @@ -74,7 +75,6 @@ class CloudWebsocketTransportAdapter : public TransportAdapterImpl { */ const CloudAppProperties& GetAppCloudTransportConfig(std::string app_id); - protected: /** * @brief Return type of device. @@ -98,7 +98,7 @@ class CloudWebsocketTransportAdapter : public TransportAdapterImpl { void CreateDevice(const std::string& uid) OVERRIDE; private: - CloudAppTransportConfig transport_config_; + CloudAppTransportConfig transport_config_; }; } // namespace transport_adapter diff --git a/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h index 64f55106a1..adbe17112c 100644 --- a/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h +++ b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h @@ -64,7 +64,7 @@ using ::utils::MessageQueue; typedef std::queue<protocol_handler::RawMessagePtr> AsyncQueue; typedef protocol_handler::RawMessagePtr Message; typedef websocket::stream<tcp::socket> WS; -typedef websocket::stream<ssl::stream<tcp::socket>> WSS; +typedef websocket::stream<ssl::stream<tcp::socket> > WSS; typedef std::shared_ptr<WS> WSptr; typedef std::shared_ptr<WSS> WSSptr; @@ -125,7 +125,7 @@ class WebsocketClientConnection /** * @brief Attempt to add provided certificate to the ssl::context - * + * * @param cert Certificate string from policy table * @return true if certificate was not invalid and was added successfully */ diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h index 8419f90398..2688ee7c19 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h @@ -139,7 +139,9 @@ class TransportManagerImpl **/ int SearchDevices() OVERRIDE; - void AddCloudDevice(const transport_manager::transport_adapter::CloudAppProperties cloud_properties) OVERRIDE; + void AddCloudDevice( + const transport_manager::transport_adapter::CloudAppProperties + cloud_properties) OVERRIDE; /** * @brief Connect to all applications discovered on device. diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc index 68f6ed0a90..8f2563a142 100644 --- a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc +++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc @@ -53,18 +53,13 @@ CloudWebsocketTransportAdapter::CloudWebsocketTransportAdapter( CloudWebsocketTransportAdapter::~CloudWebsocketTransportAdapter() {} -void CloudWebsocketTransportAdapter::SetAppCloudTransportConfig(std::string app_id, CloudAppProperties properties) { +void CloudWebsocketTransportAdapter::SetAppCloudTransportConfig( + std::string app_id, CloudAppProperties properties) { transport_config_[app_id] = properties; - // LOG4CXX_DEBUG(logger_, "CLOUD_TRANS_ADP: " << app_id); - // LOG4CXX_DEBUG(logger_, "ENDPOINT: " << transport_config_[app_id].endpoint); - // LOG4CXX_DEBUG(logger_, "ENABLED: " << transport_config_[app_id].enabled); - // LOG4CXX_DEBUG(logger_, "CERTIFICATE: " << transport_config_[app_id].certificate); - // LOG4CXX_DEBUG(logger_, "AUTH_TOKEN: " << transport_config_[app_id].auth_token); - // LOG4CXX_DEBUG(logger_, "TRANSPORT_TYPE: " << transport_config_[app_id].cloud_transport_type); - // LOG4CXX_DEBUG(logger_, "HYBRID: " << transport_config_[app_id].hybrid_app_preference); } -const CloudAppProperties& CloudWebsocketTransportAdapter::GetAppCloudTransportConfig(std::string app_id){ +const CloudAppProperties& +CloudWebsocketTransportAdapter::GetAppCloudTransportConfig(std::string app_id) { return transport_config_[app_id]; } @@ -79,7 +74,6 @@ bool CloudWebsocketTransportAdapter::Restore() { } void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_CreateDevice: " << uid); boost::regex pattern( "(wss?):\\/\\/([A-Z\\d\\.-]{2,})\\.?([A-Z]{2,})?(:\\d{2,4})\\/", boost::regex::icase); @@ -89,8 +83,6 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { return; } - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_RegexMatchPassed"); - LOG4CXX_DEBUG(logger_, "Valid Endpoint: " << uid); // Port after second colon in valid endpoint string @@ -117,8 +109,6 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { return; } - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_RegexSearchPassed"); - std::string device_id = uid; LOG4CXX_DEBUG(logger_, @@ -127,9 +117,6 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { auto cloud_device = std::make_shared<CloudDevice>(host, port, device_id); - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_CreatedCloudDevice: " << host << ", " << port << ", " << device_id); - - DeviceVector devices{cloud_device}; SearchDeviceDone(devices); @@ -138,8 +125,6 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { std::shared_ptr<WebsocketClientConnection> connection = std::make_shared<WebsocketClientConnection>(uid, 0, this); - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_CreatedConnection"); - ConnectionCreated(connection, uid, 0); ConnectPending(uid, 0); diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc index 5916cb39d8..e6da3e9b6c 100644 --- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc +++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc @@ -54,12 +54,8 @@ WebsocketClientConnection::WebsocketClientConnection( , write_thread_(threads::CreateThread("WS Async Send", thread_delegate_)) , device_uid_(device_uid) , app_handle_(app_handle) { - - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_WEBSOCKETCLIENTCONNECTION"); - - } - - + LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_WEBSOCKETCLIENTCONNECTION"); +} WebsocketClientConnection::~WebsocketClientConnection() { ioc_.stop(); @@ -68,14 +64,18 @@ WebsocketClientConnection::~WebsocketClientConnection() { } } -bool WebsocketClientConnection::AddCertificateAuthority(const std::string cert, boost::system::error_code& ec){ - ctx_.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), ec); - if(ec){ +bool WebsocketClientConnection::AddCertificateAuthority( + const std::string cert, boost::system::error_code& ec) { + ctx_.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), + ec); + if (ec) { return false; } - boost::get<WSSptr>(dynamic_ws_)->next_layer().set_verify_mode(ssl::verify_peer); - if(ec){ + boost::get<WSSptr>(dynamic_ws_) + ->next_layer() + .set_verify_mode(ssl::verify_peer); + if (ec) { return false; } @@ -86,18 +86,21 @@ TransportAdapter::Error WebsocketClientConnection::Start() { LOG4CXX_AUTO_TRACE(logger_); DeviceSptr device = controller_->FindDevice(device_uid_); CloudDevice* cloud_device = static_cast<CloudDevice*>(device.get()); - CloudWebsocketTransportAdapter* cloud_ta = static_cast<CloudWebsocketTransportAdapter*>(controller_); + CloudWebsocketTransportAdapter* cloud_ta = + static_cast<CloudWebsocketTransportAdapter*>(controller_); cloud_properties = cloud_ta->GetAppCloudTransportConfig(device_uid_); auto const host = cloud_device->GetHost(); auto const port = cloud_device->GetPort(); boost::system::error_code ec; - LOG4CXX_DEBUG(logger_, "CLOUD_CONN_START"); + LOG4CXX_DEBUG(logger_, "CLOUD_CONN_START"); LOG4CXX_DEBUG(logger_, "ENDPOINT: " << cloud_properties.endpoint); LOG4CXX_DEBUG(logger_, "CERTIFICATE: " << cloud_properties.certificate); LOG4CXX_DEBUG(logger_, "AUTH_TOKEN: " << cloud_properties.auth_token); - LOG4CXX_DEBUG(logger_, "TRANSPORT_TYPE: " << cloud_properties.cloud_transport_type); - LOG4CXX_DEBUG(logger_, "HYBRID_APP_PREF: " << cloud_properties.hybrid_app_preference); + LOG4CXX_DEBUG(logger_, + "TRANSPORT_TYPE: " << cloud_properties.cloud_transport_type); + LOG4CXX_DEBUG(logger_, + "HYBRID_APP_PREF: " << cloud_properties.hybrid_app_preference); auto const results = resolver_.resolve(host, port, ec); if (ec) { @@ -107,19 +110,26 @@ TransportAdapter::Error WebsocketClientConnection::Start() { return TransportAdapter::FAIL; } - LOG4CXX_DEBUG(logger_, "CLOUD_CONN_RESOLVE"); + LOG4CXX_DEBUG(logger_, "CLOUD_CONN_RESOLVE"); - if(cloud_properties.cloud_transport_type == "WSS"){ + if (cloud_properties.cloud_transport_type == "WSS") { dynamic_ws_ = std::make_shared<WSS>(ioc_, ctx_); - }else{ + } else { dynamic_ws_ = std::make_shared<WS>(ioc_); } // Make Connection to host IP Address over TCP - if(cloud_properties.cloud_transport_type == "WSS"){ - boost::asio::connect(boost::get<WSSptr>(dynamic_ws_)->next_layer().next_layer(), results.begin(), results.end(), ec); - }else{ - boost::asio::connect(boost::get<WSptr>(dynamic_ws_)->next_layer(), results.begin(), results.end(), ec); + if (cloud_properties.cloud_transport_type == "WSS") { + boost::asio::connect( + boost::get<WSSptr>(dynamic_ws_)->next_layer().next_layer(), + results.begin(), + results.end(), + ec); + } else { + boost::asio::connect(boost::get<WSptr>(dynamic_ws_)->next_layer(), + results.begin(), + results.end(), + ec); } if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); @@ -130,47 +140,49 @@ TransportAdapter::Error WebsocketClientConnection::Start() { return TransportAdapter::FAIL; } - LOG4CXX_DEBUG(logger_, "CLOUD_CONN_TCP"); - - if(cloud_properties.cloud_transport_type == "WSS"){ + LOG4CXX_DEBUG(logger_, "CLOUD_CONN_TCP"); + + if (cloud_properties.cloud_transport_type == "WSS") { bool isAdded = AddCertificateAuthority(cloud_properties.certificate, ec); - if(isAdded){ + if (isAdded) { LOG4CXX_INFO(logger_, "Certificate Authority added successfully"); - }else{ + } else { LOG4CXX_INFO(logger_, "Failed to add certificate authority"); } - if(ec){ + if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); LOG4CXX_ERROR(logger_, - "Failed to add certificate authority: " << cloud_properties.certificate); + "Failed to add certificate authority: " + << cloud_properties.certificate); LOG4CXX_ERROR(logger_, str_err); Shutdown(); return TransportAdapter::FAIL; } - - //Perform SSL Handshake - boost::get<WSSptr>(dynamic_ws_)->next_layer().handshake(ssl::stream_base::client, ec); + + // Perform SSL Handshake + boost::get<WSSptr>(dynamic_ws_) + ->next_layer() + .handshake(ssl::stream_base::client, ec); if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); LOG4CXX_ERROR(logger_, - "Could not complete SSL Handshake failed with host/port: " << host << ":" - << port); + "Could not complete SSL Handshake failed with host/port: " + << host << ":" << port); LOG4CXX_ERROR(logger_, str_err); Shutdown(); return TransportAdapter::FAIL; } - LOG4CXX_DEBUG(logger_, "CLOUD_CONN_SSL"); + LOG4CXX_DEBUG(logger_, "CLOUD_CONN_SSL"); } - // Perform websocket handshake - if(cloud_properties.cloud_transport_type == "WSS"){ + if (cloud_properties.cloud_transport_type == "WSS") { boost::get<WSSptr>(dynamic_ws_)->handshake(host, "/", ec); - }else{ + } else { boost::get<WSptr>(dynamic_ws_)->handshake(host, "/", ec); } if (ec) { @@ -183,30 +195,32 @@ TransportAdapter::Error WebsocketClientConnection::Start() { return TransportAdapter::FAIL; } - LOG4CXX_DEBUG(logger_, "CLOUD_CONN_WEBSOCKET"); - + LOG4CXX_DEBUG(logger_, "CLOUD_CONN_WEBSOCKET"); + // Set the binary message write option - if(cloud_properties.cloud_transport_type == "WSS"){ + if (cloud_properties.cloud_transport_type == "WSS") { boost::get<WSSptr>(dynamic_ws_)->binary(true); - }else{ + } else { boost::get<WSptr>(dynamic_ws_)->binary(true); } write_thread_->start(threads::ThreadOptions()); controller_->ConnectDone(device_uid_, app_handle_); // Start async read - if(cloud_properties.cloud_transport_type == "WSS"){ - boost::get<WSSptr>(dynamic_ws_)->async_read(buffer_, - std::bind(&WebsocketClientConnection::OnRead, - this, - std::placeholders::_1, - std::placeholders::_2)); - }else{ - boost::get<WSptr>(dynamic_ws_)->async_read(buffer_, - std::bind(&WebsocketClientConnection::OnRead, - this, - std::placeholders::_1, - std::placeholders::_2)); + if (cloud_properties.cloud_transport_type == "WSS") { + boost::get<WSSptr>(dynamic_ws_) + ->async_read(buffer_, + std::bind(&WebsocketClientConnection::OnRead, + this, + std::placeholders::_1, + std::placeholders::_2)); + } else { + boost::get<WSptr>(dynamic_ws_) + ->async_read(buffer_, + std::bind(&WebsocketClientConnection::OnRead, + this, + std::placeholders::_1, + std::placeholders::_2)); } // Start IO Service thread. Allows for async reads without blocking. io_service_thread_ = std::thread([&]() { @@ -232,19 +246,20 @@ void WebsocketClientConnection::Recv(boost::system::error_code ec) { Shutdown(); return; } - if(cloud_properties.cloud_transport_type == "WSS"){ - boost::get<WSSptr>(dynamic_ws_)->async_read(buffer_, - std::bind(&WebsocketClientConnection::OnRead, - this, - std::placeholders::_1, - std::placeholders::_2)); - } else{ - boost::get<WSptr>(dynamic_ws_)->async_read(buffer_, - std::bind(&WebsocketClientConnection::OnRead, - this, - std::placeholders::_1, - std::placeholders::_2)); - + if (cloud_properties.cloud_transport_type == "WSS") { + boost::get<WSSptr>(dynamic_ws_) + ->async_read(buffer_, + std::bind(&WebsocketClientConnection::OnRead, + this, + std::placeholders::_1, + std::placeholders::_2)); + } else { + boost::get<WSptr>(dynamic_ws_) + ->async_read(buffer_, + std::bind(&WebsocketClientConnection::OnRead, + this, + std::placeholders::_1, + std::placeholders::_2)); } } @@ -329,15 +344,15 @@ void WebsocketClientConnection::LoopThreadDelegate::DrainQueue() { message_queue_.pop(message_ptr); if (!shutdown_) { boost::system::error_code ec; - if(handler_.cloud_properties.cloud_transport_type == "WSS"){ - - boost::get<WSSptr>(handler_.dynamic_ws_)->write( - boost::asio::buffer(message_ptr->data(), message_ptr->data_size())); - }else{ - boost::get<WSptr>(handler_.dynamic_ws_)->write( - boost::asio::buffer(message_ptr->data(), message_ptr->data_size())); - - } + if (handler_.cloud_properties.cloud_transport_type == "WSS") { + boost::get<WSSptr>(handler_.dynamic_ws_) + ->write(boost::asio::buffer(message_ptr->data(), + message_ptr->data_size())); + } else { + boost::get<WSptr>(handler_.dynamic_ws_) + ->write(boost::asio::buffer(message_ptr->data(), + message_ptr->data_size())); + } if (ec) { LOG4CXX_ERROR(logger_, "Error writing to websocket"); handler_.Shutdown(); diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index 1f57436d60..3de12fdf9e 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -130,13 +130,15 @@ void TransportManagerImpl::ReconnectionTimeout() { device_to_reconnect_); } -void TransportManagerImpl::AddCloudDevice(const transport_manager::transport_adapter::CloudAppProperties cloud_properties) { +void TransportManagerImpl::AddCloudDevice( + const transport_manager::transport_adapter::CloudAppProperties + cloud_properties) { // todo put conversion into own function - LOG4CXX_DEBUG(logger_, "CLOUD_DEBUG_AddCloudDevice: " << cloud_properties.cloud_transport_type); transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN; - if ((cloud_properties.cloud_transport_type == "WS") || (cloud_properties.cloud_transport_type == "WSS")) { - type = transport_adapter::DeviceType::CLOUD_WEBSOCKET; + if ((cloud_properties.cloud_transport_type == "WS") || + (cloud_properties.cloud_transport_type == "WSS")) { + type = transport_adapter::DeviceType::CLOUD_WEBSOCKET; } else { return; } @@ -145,15 +147,10 @@ void TransportManagerImpl::AddCloudDevice(const transport_manager::transport_ada for (; ta != transport_adapters_.end(); ++ta) { if ((*ta)->GetDeviceType() == type) { (*ta)->CreateDevice(cloud_properties.endpoint); - transport_adapter::CloudWebsocketTransportAdapter* cta = static_cast<transport_adapter::CloudWebsocketTransportAdapter*>(*ta); - // LOG4CXX_DEBUG(logger_, "CLOUD_TRANS_MGR: "); - // LOG4CXX_DEBUG(logger_, "ENDPOINT: " << cloud_properties.endpoint); - // LOG4CXX_DEBUG(logger_, "ENABLED: " << cloud_properties.enabled); - // LOG4CXX_DEBUG(logger_, "CERTIFICATE: " << cloud_properties.certificate); - // LOG4CXX_DEBUG(logger_, "AUTH_TOKEN: " << cloud_properties.auth_token); - // LOG4CXX_DEBUG(logger_, "TRANSPORT_TYPE: " << cloud_properties.cloud_transport_type); - // LOG4CXX_DEBUG(logger_, "HYBRID: " << cloud_properties.hybrid_app_preference); - cta->SetAppCloudTransportConfig(cloud_properties.endpoint, cloud_properties); + transport_adapter::CloudWebsocketTransportAdapter* cta = + static_cast<transport_adapter::CloudWebsocketTransportAdapter*>(*ta); + cta->SetAppCloudTransportConfig(cloud_properties.endpoint, + cloud_properties); } } |