summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/curl/Request.cxx2
-rw-r--r--src/lib/curl/Request.hxx2
-rw-r--r--src/lib/upnp/Discovery.cxx20
-rw-r--r--src/lib/upnp/Discovery.hxx8
-rw-r--r--src/storage/plugins/CurlStorage.cxx6
5 files changed, 25 insertions, 13 deletions
diff --git a/src/lib/curl/Request.cxx b/src/lib/curl/Request.cxx
index 52704a8c8..c3965434d 100644
--- a/src/lib/curl/Request.cxx
+++ b/src/lib/curl/Request.cxx
@@ -72,7 +72,7 @@ CurlRequest::~CurlRequest() noexcept
}
void
-CurlRequest::Start() noexcept
+CurlRequest::Start()
{
assert(!registered);
diff --git a/src/lib/curl/Request.hxx b/src/lib/curl/Request.hxx
index 2a60be803..26cb9584b 100644
--- a/src/lib/curl/Request.hxx
+++ b/src/lib/curl/Request.hxx
@@ -91,7 +91,7 @@ public:
*
* This method must be called in the event loop thread.
*/
- void Start() noexcept;
+ void Start();
/**
* Unregister this request via CurlGlobal::Remove().
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx
index 0ce1d6c13..33218ba79 100644
--- a/src/lib/upnp/Discovery.cxx
+++ b/src/lib/upnp/Discovery.cxx
@@ -174,15 +174,19 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco) noexcept
{
if (isMSDevice(disco->DeviceType) ||
isCDService(disco->ServiceType)) {
- auto *downloader = new Downloader(*this, *disco);
-
try {
- downloader->Start();
- } catch (...) {
- BlockingCall(GetEventLoop(), [downloader](){
- downloader->Destroy();
- });
+ auto *downloader = new Downloader(*this, *disco);
+
+ try {
+ downloader->Start();
+ } catch (...) {
+ BlockingCall(GetEventLoop(), [downloader](){
+ downloader->Destroy();
+ });
+ throw;
+ }
+ } catch (...) {
LogError(std::current_exception());
return UPNP_E_SUCCESS;
}
@@ -251,7 +255,7 @@ UPnPDeviceDirectory::ExpireDevices()
UPnPDeviceDirectory::UPnPDeviceDirectory(EventLoop &event_loop,
UpnpClient_Handle _handle,
- UPnPDiscoveryListener *_listener) noexcept
+ UPnPDiscoveryListener *_listener)
:curl(event_loop), handle(_handle),
listener(_listener)
{
diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx
index cae223d0d..a0a79157f 100644
--- a/src/lib/upnp/Discovery.hxx
+++ b/src/lib/upnp/Discovery.hxx
@@ -110,7 +110,11 @@ class UPnPDeviceDirectory final : UpnpCallback {
private:
void OnDeferredStart() noexcept {
- request.Start();
+ try {
+ request.Start();
+ } catch (...) {
+ OnError(std::current_exception());
+ }
}
/* virtual methods from CurlResponseHandler */
@@ -147,7 +151,7 @@ class UPnPDeviceDirectory final : UpnpCallback {
public:
UPnPDeviceDirectory(EventLoop &event_loop, UpnpClient_Handle _handle,
- UPnPDiscoveryListener *_listener=nullptr) noexcept;
+ UPnPDiscoveryListener *_listener=nullptr);
~UPnPDeviceDirectory() noexcept;
UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx
index 9b4ecae40..feaa1c37c 100644
--- a/src/storage/plugins/CurlStorage.cxx
+++ b/src/storage/plugins/CurlStorage.cxx
@@ -140,7 +140,11 @@ private:
void OnDeferredStart() noexcept {
assert(!done);
- request.Start();
+ try {
+ request.Start();
+ } catch (...) {
+ OnError(std::current_exception());
+ }
}
/* virtual methods from CurlResponseHandler */