From 2d16ddb2623249d3cbdde89288ae047416b62cb6 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 21 Mar 2017 23:52:22 +0100 Subject: Adding android support Change-Id: Id8d0aaf61e6576209a8e329aa26cb73113832296 Signed-off-by: Mauro Sardara --- icnet/ccnx/icnet_ccnx_local_connector.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'icnet/ccnx/icnet_ccnx_local_connector.cc') diff --git a/icnet/ccnx/icnet_ccnx_local_connector.cc b/icnet/ccnx/icnet_ccnx_local_connector.cc index 2a47c117..efe995cc 100644 --- a/icnet/ccnx/icnet_ccnx_local_connector.cc +++ b/icnet/ccnx/icnet_ccnx_local_connector.cc @@ -13,8 +13,13 @@ * limitations under the License. */ +#ifdef __ANDROID__ +#include +#endif + #include "icnet_ccnx_local_connector.h" + namespace icnet { namespace ccnx { @@ -131,7 +136,11 @@ void LocalConnector::doReadHeader() { void LocalConnector::tryReconnect() { if (!is_connecting_) { +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Connection lost. Trying to reconnect...\n"); +#else std::cerr << "Connection lost. Trying to reconnect..." << std::endl; +#endif is_connecting_ = true; is_reconnection_ = true; io_service_.post([this]() { @@ -158,7 +167,11 @@ void LocalConnector::doConnect() { if (is_reconnection_) { is_reconnection_ = false; - std::cout << "Connection recovered!" << std::endl; +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Connection recovered!\n"); +#else + std::cout << "Connection recovered!" << std::endl; +#endif for (auto &name : served_name_list_) { bind(name); } @@ -184,7 +197,11 @@ void LocalConnector::handleDeadline(const boost::system::error_code &ec) { if (!ec) { io_service_.post([this]() { socket_.close(); +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Error connecting. Is the forwarder running?\n"); +#else std::cerr << "Error connecting. Is the forwarder running?" << std::endl; +#endif io_service_.stop(); }); } -- cgit 1.2.3-korg