face: Implementing new "isOnDemand" flag
This flags replaces isPermanent flag in datagram faces, but with the
reversed logic (isPermanent = !isOnDemand)
Change-Id: I37ba604e5f105ca95a79a08b8cfc3d640df8b412
Refs: #1376
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index 9151830..390b412 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -80,7 +80,7 @@
{
ChannelFaceMap::iterator i = m_channelFaces.find(remoteEndpoint);
if (i != m_channelFaces.end()) {
- i->second->setPermanent(true);
+ i->second->setOnDemand(false);
onFaceCreated(i->second);
return;
}
@@ -104,7 +104,7 @@
throw Error("Failed to properly configure the socket. Check the address ("
+ std::string(e.what()) + ")");
}
- createFace(clientSocket, onFaceCreated, true);
+ createFace(clientSocket, onFaceCreated, false);
}
void
@@ -157,11 +157,11 @@
shared_ptr<UdpFace>
UdpChannel::createFace(const shared_ptr<ip::udp::socket>& socket,
const FaceCreatedCallback& onFaceCreated,
- bool isPermanent)
+ bool isOnDemand)
{
udp::Endpoint remoteEndpoint = socket->remote_endpoint();
- shared_ptr<UdpFace> face = make_shared<UdpFace>(boost::cref(socket), isPermanent);
+ shared_ptr<UdpFace> face = make_shared<UdpFace>(boost::cref(socket), isOnDemand);
face->onFail += bind(&UdpChannel::afterFaceFailed, this, remoteEndpoint);
onFaceCreated(face);
@@ -204,7 +204,7 @@
face = createFace(clientSocket,
onFaceCreatedNewPeerCallback,
- false);
+ true);
}
//Passing the message to the correspondent face
@@ -233,7 +233,7 @@
while (next != m_channelFaces.end()) {
ChannelFaceMap::iterator it = next;
next++;
- if (!it->second->isPermanent() &&
+ if (it->second->isOnDemand() &&
!it->second->hasBeenUsedRecently()) {
//face has been idle since the last time closeIdleFaces
//has been called. Going to close it