upnp_context: fix handling of FAILED mappings

This patch fixes a bug where mappings in the FAILED state were
sometimes left in the UPnPContext's mapping list. This is not necessary
and can lead to problems if the list grows too large.

GitLab: #45
Change-Id: I35641880160194be9c29867abb05161fbc7f9376
diff --git a/include/upnp/upnp_context.h b/include/upnp/upnp_context.h
index e29e05b..da22e25 100644
--- a/include/upnp/upnp_context.h
+++ b/include/upnp/upnp_context.h
@@ -165,10 +165,7 @@
     Mapping::sharedPtr_t registerMapping(Mapping& map);
 
     // Remove the given mapping from the local list.
-    //
-    // If the mapping has auto-update enabled, then a new mapping of the same
-    // type will be reserved unless ignoreAutoUpdate is true.
-    void unregisterMapping(const Mapping::sharedPtr_t& map, bool ignoreAutoUpdate = false);
+    void unregisterMapping(const Mapping::sharedPtr_t& map);
 
     // Perform the request on the provided IGD.
     void requestMapping(const Mapping::sharedPtr_t& map);
@@ -231,6 +228,14 @@
     // Process requests with pending status.
     void processPendingRequests();
 
+    // Handle mapping with FAILED state.
+    //
+    // There are two cases to consider: when auto-update is enabled and when it is not.
+    // If auto-update is disabled, the mapping will be unregistered.
+    // If auto-update is enabled, a new mapping of the same type will be requested if there is a valid IGD available.
+    // Otherwise, the mapping request will be marked as pending and will be requested when an IGD becomes available.
+    void handleFailedMapping(const Mapping::sharedPtr_t& map);
+
     // Implementation of UpnpMappingObserver interface.
 
     // Callback used to report changes in IGD status.