mgmt: support LpReliability flag in faces/create and faces/update
refs #4003
Change-Id: Iddf94ea55c630b038187c2503783591b118230ec
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index dee9fa6..4c4c290 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -69,7 +69,8 @@
void
TcpChannel::connect(const tcp::Endpoint& remoteEndpoint,
ndn::nfd::FacePersistency persistency,
- bool wantLocalFieldsEnabled,
+ bool wantLocalFields,
+ bool wantLpReliability,
const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onConnectFailed,
time::nanoseconds timeout)
@@ -88,15 +89,18 @@
NFD_LOG_CHAN_TRACE("Connecting to " << remoteEndpoint);
clientSocket->async_connect(remoteEndpoint,
bind(&TcpChannel::handleConnect, this,
- boost::asio::placeholders::error, remoteEndpoint,
- clientSocket, persistency, wantLocalFieldsEnabled,
+ boost::asio::placeholders::error, remoteEndpoint, clientSocket,
+ // Creating a parameters struct works around limit on number of
+ // parameters to bind
+ ConnectParams{persistency, wantLocalFields, wantLpReliability},
timeoutEvent, onFaceCreated, onConnectFailed));
}
void
TcpChannel::createFace(ip::tcp::socket&& socket,
ndn::nfd::FacePersistency persistency,
- bool wantLocalFieldsEnabled,
+ bool wantLocalFields,
+ bool wantLpReliability,
const FaceCreatedCallback& onFaceCreated)
{
shared_ptr<Face> face;
@@ -104,10 +108,10 @@
auto it = m_channelFaces.find(remoteEndpoint);
if (it == m_channelFaces.end()) {
- auto linkService = make_unique<GenericLinkService>();
- auto options = linkService->getOptions();
- options.allowLocalFields = wantLocalFieldsEnabled;
- linkService->setOptions(options);
+ GenericLinkService::Options options;
+ options.allowLocalFields = wantLocalFields;
+ options.reliabilityOptions.isEnabled = wantLpReliability;
+ auto linkService = make_unique<GenericLinkService>(options);
auto transport = make_unique<TcpTransport>(std::move(socket), persistency);
face = make_shared<Face>(std::move(linkService), std::move(transport));
@@ -154,7 +158,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, false, onFaceCreated);
// prepare accepting the next connection
accept(onFaceCreated, onAcceptFailed);
@@ -164,8 +168,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,
+ TcpChannel::ConnectParams params,
const scheduler::EventId& connectTimeoutEvent,
const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onConnectFailed)
@@ -190,7 +193,8 @@
}
NFD_LOG_CHAN_TRACE("Connected to " << socket->remote_endpoint());
- createFace(std::move(*socket), persistency, wantLocalFieldsEnabled, onFaceCreated);
+ createFace(std::move(*socket), params.persistency, params.wantLocalFields,
+ params.wantLpReliability, onFaceCreated);
}
void