mgmt+tools: rework FacePersistency handling in faces/create and faces/update
1. enable changing persistency in faces/update command
2. reject faces/create request if the face already exists
3. nfdc changes to support the above
Change-Id: I659906da846608a42a768f08fb110ceee1a947a7
refs: #3232
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index 64907be..b89a8ad 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -147,17 +147,7 @@
auto it = m_channelFaces.find(remoteEndpoint);
if (it != m_channelFaces.end()) {
// we already have a face for this endpoint, so reuse it
- auto face = it->second;
-
- // TODO #3232: Remove persistency transitions from faces/create
- // only on-demand -> persistent -> permanent transition is allowed
- bool isTransitionAllowed = persistency != face->getPersistency() &&
- (face->getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND ||
- persistency == ndn::nfd::FACE_PERSISTENCY_PERMANENT);
- if (isTransitionAllowed) {
- face->setPersistency(persistency);
- }
- return {false, face};
+ return {false, it->second};
}
// else, create a new face
@@ -170,8 +160,6 @@
auto transport = make_unique<face::UnicastUdpTransport>(std::move(socket), persistency, m_idleFaceTimeout);
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
- face->setPersistency(persistency);
-
m_channelFaces[remoteEndpoint] = face;
connectFaceClosedSignal(*face,
[this, remoteEndpoint] {