face: group parameters to createFace and connect into a common structure
Change-Id: Icb6857602ed7e897be6c5334b05be23793d133bb
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index 3f3271e..624b9cd 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -49,14 +49,13 @@
void
UdpChannel::connect(const udp::Endpoint& remoteEndpoint,
- ndn::nfd::FacePersistency persistency,
- bool wantLpReliability,
+ const FaceParams& params,
const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onConnectFailed)
{
shared_ptr<Face> face;
try {
- face = createFace(remoteEndpoint, persistency, wantLpReliability).second;
+ face = createFace(remoteEndpoint, params).second;
}
catch (const boost::system::system_error& e) {
NFD_LOG_CHAN_DEBUG("Face creation for " << remoteEndpoint << " failed: " << e.what());
@@ -121,8 +120,9 @@
bool isCreated = false;
shared_ptr<Face> face;
try {
- std::tie(isCreated, face) = createFace(m_remoteEndpoint, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
- false);
+ FaceParams params;
+ params.persistency = ndn::nfd::FACE_PERSISTENCY_ON_DEMAND;
+ std::tie(isCreated, face) = createFace(m_remoteEndpoint, params);
}
catch (const boost::system::system_error& e) {
NFD_LOG_CHAN_DEBUG("Face creation for " << m_remoteEndpoint << " failed: " << e.what());
@@ -145,8 +145,7 @@
std::pair<bool, shared_ptr<Face>>
UdpChannel::createFace(const udp::Endpoint& remoteEndpoint,
- ndn::nfd::FacePersistency persistency,
- bool wantLpReliability)
+ const FaceParams& params)
{
auto it = m_channelFaces.find(remoteEndpoint);
if (it != m_channelFaces.end()) {
@@ -162,10 +161,10 @@
socket.connect(remoteEndpoint);
GenericLinkService::Options options;
- options.reliabilityOptions.isEnabled = wantLpReliability;
+ options.reliabilityOptions.isEnabled = params.wantLpReliability;
options.allowCongestionMarking = m_wantCongestionMarking;
auto linkService = make_unique<GenericLinkService>(options);
- auto transport = make_unique<UnicastUdpTransport>(std::move(socket), persistency, m_idleFaceTimeout);
+ auto transport = make_unique<UnicastUdpTransport>(std::move(socket), params.persistency, m_idleFaceTimeout);
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
m_channelFaces[remoteEndpoint] = face;