face: Avoid calls to socket::local_endpoint()

Change-Id: I0cb9152efb95faa105a0d0e08ebfb263581d4d43
Refs: #1741
diff --git a/daemon/face/datagram-face.hpp b/daemon/face/datagram-face.hpp
index 6f111e7..dff2012 100644
--- a/daemon/face/datagram-face.hpp
+++ b/daemon/face/datagram-face.hpp
@@ -164,7 +164,7 @@
     }
 
     NFD_LOG_WARN("[id:" << this->getId()
-                  << ",endpoint:" << m_socket->local_endpoint()
+                  << ",uri:" << this->getRemoteUri()
                   << "] Send operation failed, closing socket: "
                   << error.category().message(error.value()));
 
@@ -183,7 +183,7 @@
   }
 
   NFD_LOG_TRACE("[id:" << this->getId()
-                << ",endpoint:" << m_socket->local_endpoint()
+                << ",uri:" << this->getRemoteUri()
                 << "] Successfully sent: " << wire.size() << " bytes");
   // do nothing (needed to retain validity of wire memory block
 }
@@ -196,7 +196,7 @@
     return;
 
   NFD_LOG_INFO("[id:" << this->getId()
-               << ",endpoint:" << m_socket->local_endpoint()
+               << ",uri:" << this->getRemoteUri()
                << "] Close tunnel");
 
   closeSocket();
@@ -233,7 +233,7 @@
     }
 
     NFD_LOG_WARN("[id:" << this->getId()
-                 << ",endpoint:" << m_socket->local_endpoint()
+                 << ",uri:" << this->getRemoteUri()
                  << "] Receive operation failed: "
                  << error.category().message(error.value()));
 
@@ -252,7 +252,7 @@
   }
 
   NFD_LOG_TRACE("[id:" << this->getId()
-                << ",endpoint:" << m_socket->local_endpoint()
+                << ",uri:" << this->getRemoteUri()
                 << "] Received: " << nBytesReceived << " bytes");
 
   Block element;
@@ -260,7 +260,7 @@
   if (!isOk)
     {
       NFD_LOG_WARN("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Failed to parse incoming packet");
       // This message won't extend the face lifetime
       return;
@@ -269,7 +269,7 @@
   if (element.size() != nBytesReceived)
     {
       NFD_LOG_WARN("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Received datagram size and decoded "
                    << "element size don't match");
       // This message won't extend the face lifetime
@@ -279,7 +279,7 @@
   if (!this->decodeAndDispatchInput(element))
     {
       NFD_LOG_WARN("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Received unrecognized block of type ["
                    << element.type() << "]");
       // This message won't extend the face lifetime
@@ -300,7 +300,10 @@
 inline void
 DatagramFace<T, U>::closeSocket()
 {
-  NFD_LOG_DEBUG("closeSocket  " << m_socket->local_endpoint());
+  NFD_LOG_DEBUG("[id:" << this->getId()
+                << ",uri:" << this->getRemoteUri()
+                << "] closeSocket");
+
   boost::asio::io_service& io = m_socket->get_io_service();
 
   // use the non-throwing variants and ignore errors, if any
diff --git a/daemon/face/stream-face.hpp b/daemon/face/stream-face.hpp
index 12cc2bc..f9b7cd9 100644
--- a/daemon/face/stream-face.hpp
+++ b/daemon/face/stream-face.hpp
@@ -208,7 +208,7 @@
     return;
 
   NFD_LOG_INFO("[id:" << this->getId()
-               << ",endpoint:" << m_socket->local_endpoint()
+               << ",uri:" << this->getRemoteUri()
                << "] Close connection");
 
   closeSocket();
@@ -231,13 +231,13 @@
   if (error == boost::asio::error::eof)
     {
       NFD_LOG_INFO("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Connection closed");
     }
   else
     {
       NFD_LOG_WARN("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Send or receive operation failed, closing socket: "
                    << error.category().message(error.value()));
     }
@@ -265,7 +265,7 @@
     return processErrorCode(error);
 
   NFD_LOG_TRACE("[id:" << this->getId()
-                << ",endpoint:" << m_socket->local_endpoint()
+                << ",uri:" << this->getRemoteUri()
                 << "] Successfully sent: " << wire.size() << " bytes");
 }
 
@@ -278,7 +278,7 @@
     return processErrorCode(error);
 
   NFD_LOG_TRACE("[id:" << this->getId()
-                << ",endpoint:" << m_socket->local_endpoint()
+                << ",uri:" << this->getRemoteUri()
                 << "] Successfully sent: " << (header.size()+payload.size()) << " bytes");
 }
 
@@ -291,7 +291,7 @@
     return processErrorCode(error);
 
   NFD_LOG_TRACE("[id:" << this->getId()
-                << ",endpoint:" << m_socket->local_endpoint()
+                << ",uri:" << this->getRemoteUri()
                 << "] Received: " << bytes_recvd << " bytes");
 
   m_inputBufferSize += bytes_recvd;
@@ -314,7 +314,7 @@
       if (!this->decodeAndDispatchInput(element))
         {
           NFD_LOG_WARN("[id:" << this->getId()
-                       << ",endpoint:" << m_socket->local_endpoint()
+                       << ",uri:" << this->getRemoteUri()
                        << "] Received unrecognized block of type ["
                        << element.type() << "]");
           // ignore unknown packet and proceed
@@ -323,7 +323,7 @@
   if (!isOk && m_inputBufferSize == MAX_NDN_PACKET_SIZE && offset == 0)
     {
       NFD_LOG_WARN("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Failed to parse incoming packet or it is too large to process, "
                    << "closing down the face");
 
diff --git a/daemon/face/udp-face.cpp b/daemon/face/udp-face.cpp
index 7464c3f..81e915c 100644
--- a/daemon/face/udp-face.cpp
+++ b/daemon/face/udp-face.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "udp-face.hpp"
 
@@ -60,7 +61,7 @@
                    IP_MTU_DISCOVER, &value, sizeof(value)) < 0)
     {
       NFD_LOG_WARN("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Failed to disable path MTU discovery");
     }
 #endif
@@ -108,7 +109,7 @@
       NFD_LOG_DEBUG("Found idle face id: " << getId());
 
       NFD_LOG_INFO("[id:" << this->getId()
-                   << ",endpoint:" << m_socket->local_endpoint()
+                   << ",uri:" << this->getRemoteUri()
                    << "] Idle for more than " << m_idleTimeout << ", closing");
       close();
     }