face: allow the creation of permanent TCP faces
Change-Id: I516c176b000a78012f2ef7bd7f1f3e74c1758a94
Refs: #3167
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index f9a8eb7..dee9fa6 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -68,6 +68,7 @@
void
TcpChannel::connect(const tcp::Endpoint& remoteEndpoint,
+ ndn::nfd::FacePersistency persistency,
bool wantLocalFieldsEnabled,
const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onConnectFailed,
@@ -88,8 +89,8 @@
clientSocket->async_connect(remoteEndpoint,
bind(&TcpChannel::handleConnect, this,
boost::asio::placeholders::error, remoteEndpoint,
- clientSocket, wantLocalFieldsEnabled, timeoutEvent,
- onFaceCreated, onConnectFailed));
+ clientSocket, persistency, wantLocalFieldsEnabled,
+ timeoutEvent, onFaceCreated, onConnectFailed));
}
void
@@ -153,9 +154,7 @@
}
NFD_LOG_CHAN_TRACE("Incoming connection from " << m_socket.remote_endpoint());
-
- createFace(std::move(m_socket), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
- false, onFaceCreated);
+ createFace(std::move(m_socket), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, false, onFaceCreated);
// prepare accepting the next connection
accept(onFaceCreated, onAcceptFailed);
@@ -165,6 +164,7 @@
TcpChannel::handleConnect(const boost::system::error_code& error,
const tcp::Endpoint& remoteEndpoint,
const shared_ptr<ip::tcp::socket>& socket,
+ ndn::nfd::FacePersistency persistency,
bool wantLocalFieldsEnabled,
const scheduler::EventId& connectTimeoutEvent,
const FaceCreatedCallback& onFaceCreated,
@@ -190,8 +190,7 @@
}
NFD_LOG_CHAN_TRACE("Connected to " << socket->remote_endpoint());
- createFace(std::move(*socket), ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
- wantLocalFieldsEnabled, onFaceCreated);
+ createFace(std::move(*socket), persistency, wantLocalFieldsEnabled, onFaceCreated);
}
void