From ac963b5c164bf1685cbe4ba024eab3b9a1e46e4b Mon Sep 17 00:00:00 2001 From: Eden Abitbol <eden.abitbol@savoirfairelinux.com> Date: Thu, 19 Sep 2019 14:13:29 -0400 Subject: [PATCH] upnp: fix intermittent xml download error Depending on the platform, libupnp sometimes fails to download the xml document provided by devices that answer the search request. re-enabling blocking the blocking tcp connections at compile time for libupnp seems to fix this issue. The function used by the libupnp api to download the xml documents is purely synchronous. To prevent the function from blocking the upnp thread in case it hangs in the api, we used the disable blocking tcp connection flag. Now that std::future is used to circumvent this problem, we can re-enable the blocking tcp connection. Change-Id: I6efa02521e25171fcbca8c58a2c93987f5414f29 --- contrib/src/upnp/rules.mak | 4 ++-- src/upnp/protocol/pupnp/pupnp.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak index 31073aa6ca..5d995c7bb5 100644 --- a/contrib/src/upnp/rules.mak +++ b/contrib/src/upnp/rules.mak @@ -25,10 +25,10 @@ endif .upnp: upnp ifdef HAVE_WIN32 $(RECONF) - cd $< && $(HOSTVARS) CFLAGS="-DUPNP_STATIC_LIB" ./configure --disable-largefile --disable-samples --without-documentation --disable-blocking_tcp_connections $(HOSTCONF) + cd $< && $(HOSTVARS) CFLAGS="-DUPNP_STATIC_LIB" ./configure --disable-largefile --disable-samples --without-documentation $(HOSTCONF) else $(RECONF) - cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -DUPNP_STATIC_LIB" ./configure --disable-largefile --disable-samples --without-documentation --disable-blocking_tcp_connections $(HOSTCONF) + cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -DUPNP_STATIC_LIB" ./configure --disable-largefile --disable-samples --without-documentation $(HOSTCONF) endif cd $< && $(MAKE) install touch $@ diff --git a/src/upnp/protocol/pupnp/pupnp.h b/src/upnp/protocol/pupnp/pupnp.h index 77c136ddc9..b479267c1e 100644 --- a/src/upnp/protocol/pupnp/pupnp.h +++ b/src/upnp/protocol/pupnp/pupnp.h @@ -68,7 +68,7 @@ constexpr static int ARRAY_IDX_INVALID = 713; constexpr static int CONFLICT_IN_MAPPING = 718; // Timeout values (in seconds). -constexpr static unsigned int SEARCH_TIMEOUT {30}; +constexpr static unsigned int SEARCH_TIMEOUT {5}; constexpr static unsigned int SUBSCRIBE_TIMEOUT {300}; class PUPnP : public UPnPProtocol -- GitLab