UPnPContext: fix deadlock during shutdown

GitLab: #19
Change-Id: Id8adf0faca9e575ce035d7e9a1cc5744d92ef635
diff --git a/src/upnp/upnp_context.cpp b/src/upnp/upnp_context.cpp
index 6a7273e..0bbd282 100644
--- a/src/upnp/upnp_context.cpp
+++ b/src/upnp/upnp_context.cpp
@@ -112,6 +112,10 @@
     } else {
         if (logger_) logger_->error("Shutdown timed-out");
     }
+    // NOTE: It's important to unlock mappingMutex_ here, otherwise we get a
+    // deadlock when the call to cv.wait_for() above times out before we return
+    // from proto->terminate() in shutdown(cv).
+    lk.unlock();
 
     if (ioContextRunner_) {
         if (logger_) logger_->debug("UPnPContext: stopping io_context thread {}", fmt::ptr(this));