transport: add logging statements in UnixTransport
refs #3563
Change-Id: Id8fee87530fd8dded2b7d7471bea47b42915aeb1
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index be5536e..34ccf83 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -24,6 +24,10 @@
#include "../face.hpp"
#include "net/face-uri.hpp"
+#include "util/logger.hpp"
+
+NDN_LOG_INIT(ndn.UnixTransport);
+// DEBUG level: connect, close, pause, resume.
namespace ndn {
@@ -32,9 +36,7 @@
{
}
-UnixTransport::~UnixTransport()
-{
-}
+UnixTransport::~UnixTransport() = default;
std::string
UnixTransport::getSocketNameFromUri(const std::string& uriString)
@@ -75,6 +77,8 @@
UnixTransport::connect(boost::asio::io_service& ioService,
const ReceiveCallback& receiveCallback)
{
+ NDN_LOG_DEBUG("connect path=" << m_unixSocket);
+
if (m_impl == nullptr) {
Transport::connect(ioService, receiveCallback);
@@ -102,6 +106,7 @@
UnixTransport::close()
{
BOOST_ASSERT(m_impl != nullptr);
+ NDN_LOG_DEBUG("close");
m_impl->close();
m_impl.reset();
}
@@ -110,6 +115,7 @@
UnixTransport::pause()
{
if (m_impl != nullptr) {
+ NDN_LOG_DEBUG("pause");
m_impl->pause();
}
}
@@ -118,6 +124,7 @@
UnixTransport::resume()
{
BOOST_ASSERT(m_impl != nullptr);
+ NDN_LOG_DEBUG("resume");
m_impl->resume();
}
diff --git a/src/transport/unix-transport.hpp b/src/transport/unix-transport.hpp
index ec73488..d54f02b 100644
--- a/src/transport/unix-transport.hpp
+++ b/src/transport/unix-transport.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -68,7 +68,7 @@
send(const Block& header, const Block& payload) override;
/** \brief Create transport with parameters defined in URI
- * \throw Transport::Error if incorrect URI or unsupported protocol is specified
+ * \throw Transport::Error incorrect URI or unsupported protocol is specified
*/
static shared_ptr<UnixTransport>
create(const std::string& uri);
@@ -80,8 +80,8 @@
private:
std::string m_unixSocket;
- typedef StreamTransportImpl<UnixTransport, boost::asio::local::stream_protocol> Impl;
- friend class StreamTransportImpl<UnixTransport, boost::asio::local::stream_protocol>;
+ using Impl = StreamTransportImpl<UnixTransport, boost::asio::local::stream_protocol>;
+ friend Impl;
shared_ptr<Impl> m_impl;
};