table: delete PIT in-record and out-record when face is destroyed

refs #3685

Change-Id: I3c20417c9a30db69c90c9d59a30af1529bc1f98e
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 5db1ce2..57cbf53 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -124,17 +124,35 @@
 }
 
 void
-Pit::erase(shared_ptr<pit::Entry> pitEntry)
+Pit::erase(shared_ptr<pit::Entry> entry)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.getEntry(*pitEntry);
-  BOOST_ASSERT(nameTreeEntry != nullptr);
+  this->erase(entry, true);
+}
 
-  nameTreeEntry->erasePitEntry(pitEntry);
-  m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
+void
+Pit::erase(shared_ptr<pit::Entry> entry, bool canDeleteNte)
+{
+  shared_ptr<name_tree::Entry> nte = m_nameTree.getEntry(*entry);
+  BOOST_ASSERT(nte != nullptr);
 
+  nte->erasePitEntry(entry);
+  if (canDeleteNte) {
+    m_nameTree.eraseEntryIfEmpty(nte);
+  }
   --m_nItems;
 }
 
+void
+Pit::deleteInOutRecords(shared_ptr<pit::Entry> entry, const Face& face)
+{
+  BOOST_ASSERT(entry != nullptr);
+
+  entry->deleteInRecord(face);
+  entry->deleteOutRecord(face);
+
+  /// \todo decide whether to delete PIT entry if there's no more in/out-record left
+}
+
 Pit::const_iterator
 Pit::begin() const
 {