aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/upnp/upnpplib.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/upnp/upnpplib.cxx22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/lib/upnp/upnpplib.cxx b/src/lib/upnp/upnpplib.cxx
index 452c033d5..d36fc3593 100644
--- a/src/lib/upnp/upnpplib.cxx
+++ b/src/lib/upnp/upnpplib.cxx
@@ -21,33 +21,24 @@
#include "upnpplib.hxx"
#include "Callback.hxx"
#include "Domain.hxx"
+#include "Init.hxx"
#include "Log.hxx"
-#include <upnp/ixml.h>
#include <upnp/upnptools.h>
LibUPnP::LibUPnP()
{
- auto code = UpnpInit(0, 0);
- if (code != UPNP_E_SUCCESS) {
- init_error.Format(upnp_domain, code,
- "UpnpInit() failed: %s",
- UpnpGetErrorMessage(code));
+ if (!UpnpGlobalInit(init_error))
return;
- }
-
- UpnpSetMaxContentLength(2000*1024);
- code = UpnpRegisterClient(o_callback, nullptr, &m_clh);
+ auto code = UpnpRegisterClient(o_callback, nullptr, &m_clh);
if (code != UPNP_E_SUCCESS) {
+ UpnpGlobalFinish();
init_error.Format(upnp_domain, code,
"UpnpRegisterClient() failed: %s",
UpnpGetErrorMessage(code));
return;
}
-
- // Servers sometimes make error (e.g.: minidlna returns bad utf-8)
- ixmlRelaxParser(1);
}
int
@@ -65,8 +56,5 @@ LibUPnP::o_callback(Upnp_EventType et, void* evp, void* cookie)
LibUPnP::~LibUPnP()
{
- int error = UpnpFinish();
- if (error != UPNP_E_SUCCESS)
- FormatError(upnp_domain, "UpnpFinish() failed: %s",
- UpnpGetErrorMessage(error));
+ UpnpGlobalFinish();
}