From af3cbf6c812a8891c07f9f1bf1eaf0c6e4da585a Mon Sep 17 00:00:00 2001 From: J0WI <J0WI@users.noreply.github.com> Date: Sun, 16 Apr 2023 03:40:30 +0200 Subject: [PATCH] community/net-cpp: upgrade to 3.1.0 --- ...ulti-handle-timer_callback-correctly.patch | 35 ---------- ...imer_callback-behavior-with-0-timeou.patch | 65 ------------------- community/net-cpp/APKBUILD | 10 +-- 3 files changed, 3 insertions(+), 107 deletions(-) delete mode 100644 community/net-cpp/0001-curl-multi-handle-timer_callback-correctly.patch delete mode 100644 community/net-cpp/0002-curl-multi-fix-timer_callback-behavior-with-0-timeou.patch diff --git a/community/net-cpp/0001-curl-multi-handle-timer_callback-correctly.patch b/community/net-cpp/0001-curl-multi-handle-timer_callback-correctly.patch deleted file mode 100644 index bc48a0dd4a4b..000000000000 --- a/community/net-cpp/0001-curl-multi-handle-timer_callback-correctly.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 211abf28ea6ff067776caacf97287e97ab21acac Mon Sep 17 00:00:00 2001 -From: Luca Weiss <luca@z3ntu.xyz> -Date: Sat, 18 Jun 2022 11:33:51 +0200 -Subject: [PATCH 1/2] curl/multi: handle timer_callback correctly - -As per libcurl documentation: - -> A timeout_ms value of -1 passed to this callback means you should -> delete the timer. All other values are valid expire times in number of -> milliseconds. - -Adjust the code to match this. ---- - src/core/net/http/impl/curl/multi.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/core/net/http/impl/curl/multi.cpp b/src/core/net/http/impl/curl/multi.cpp -index fd7d534..acfa8a1 100644 ---- a/src/core/net/http/impl/curl/multi.cpp -+++ b/src/core/net/http/impl/curl/multi.cpp -@@ -428,8 +428,9 @@ int multi::Handle::Private::timer_callback( - long timeout_ms, - void* cookie) - { -- if (timeout_ms < 0) -- return -1; -+ /* -1 means we should just delete our timer. */ -+ if (timeout_ms == -1) -+ return 0; - - auto holder = static_cast<Private::Holder*>(cookie); - --- -2.36.1 - diff --git a/community/net-cpp/0002-curl-multi-fix-timer_callback-behavior-with-0-timeou.patch b/community/net-cpp/0002-curl-multi-fix-timer_callback-behavior-with-0-timeou.patch deleted file mode 100644 index 3394d0f991bc..000000000000 --- a/community/net-cpp/0002-curl-multi-fix-timer_callback-behavior-with-0-timeou.patch +++ /dev/null @@ -1,65 +0,0 @@ -From d0f636236b0bb013ca8f51af4041244d702cb0e3 Mon Sep 17 00:00:00 2001 -From: Luca Weiss <luca@z3ntu.xyz> -Date: Sat, 18 Jun 2022 11:35:58 +0200 -Subject: [PATCH 2/2] curl/multi: fix timer_callback behavior with 0 timeout - -As per libcurl documentation don't call any libcurl function directly -from the timer callback. This has worked in the past but due to possible -issues newer libcurl versions return the error CURLM_RECURSIVE_API_CALL -when this happens. ---- - src/core/net/http/impl/curl/multi.cpp | 34 ++++++++++----------------- - 1 file changed, 12 insertions(+), 22 deletions(-) - -diff --git a/src/core/net/http/impl/curl/multi.cpp b/src/core/net/http/impl/curl/multi.cpp -index acfa8a1..21cca50 100644 ---- a/src/core/net/http/impl/curl/multi.cpp -+++ b/src/core/net/http/impl/curl/multi.cpp -@@ -387,32 +387,22 @@ void multi::Handle::Private::Timeout::Private::cancel() - - void multi::Handle::Private::Timeout::Private::async_wait_for(const std::weak_ptr<Handle::Private>& context, const std::chrono::milliseconds& ms) - { -- if (ms.count() > 0) -+ std::weak_ptr<Private> self{shared_from_this()}; -+ timer.expires_from_now(boost::posix_time::milliseconds{ms.count()}); -+ timer.async_wait([self, context](const boost::system::error_code& ec) - { -- std::weak_ptr<Private> self{shared_from_this()}; -- timer.expires_from_now(boost::posix_time::milliseconds{ms.count()}); -- timer.async_wait([self, context](const boost::system::error_code& ec) -- { -- if (ec) -- return; -+ if (ec) -+ return; - -- if (auto spc = context.lock()) -+ if (auto spc = context.lock()) -+ { -+ if (auto sp = self.lock()) - { -- if (auto sp = self.lock()) -- { -- std::lock_guard<std::mutex> lg(spc->guard); -- sp->handle_timeout(spc); -- } -+ std::lock_guard<std::mutex> lg(spc->guard); -+ sp->handle_timeout(spc); - } -- }); -- } else if (ms.count() == 0) -- { -- auto sp = context.lock(); -- if (not sp) -- return; -- -- handle_timeout(sp); -- } -+ } -+ }); - } - - void multi::Handle::Private::Timeout::Private::handle_timeout(const std::shared_ptr<Handle::Private>& context) --- -2.36.1 - diff --git a/community/net-cpp/APKBUILD b/community/net-cpp/APKBUILD index b17c36d902c1..352063a2c124 100644 --- a/community/net-cpp/APKBUILD +++ b/community/net-cpp/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Luca Weiss <luca@z3ntu.xyz> pkgname=net-cpp -pkgver=3.0.0 -pkgrel=8 +pkgver=3.1.0 +pkgrel=0 pkgdesc="A simple yet beautiful networking API for C++11" url="https://gitlab.com/ubports/core/lib-cpp/net-cpp" arch="all" @@ -13,8 +13,6 @@ subpackages="$pkgname-dev" source="https://gitlab.com/ubports/core/lib-cpp/net-cpp/-/archive/$pkgver/net-cpp-$pkgver.tar.gz cxx17.patch python-init.patch - 0001-curl-multi-handle-timer_callback-correctly.patch - 0002-curl-multi-fix-timer_callback-behavior-with-0-timeou.patch " build() { @@ -40,9 +38,7 @@ package() { } sha512sums=" -c8728f0bdc6ccb14edf4f6b6c7ec4381796aa4f40ced0b5ea58494db31a52e5e785816704e932aa34a993e6e7edc4826739755abcbfcea69990ba5505fc465e6 net-cpp-3.0.0.tar.gz +a4e65651f1e31657e500cce71913bbc14cfe80fe55655d0b960abeb31ccea07e1343cd57c378b0d10ea18e4ce209e305ae4bd43206d4b5d6c3302328de294fb4 net-cpp-3.1.0.tar.gz 352fc4e3200360c1d91d025100ac33506ff705a2dd83f2d82eb8ed7426d78d1b3b5a6e548face39e17e09be63675ddcd61bb7b8f2af8ea6d299cf725c2127e68 cxx17.patch b67b50f159438513f8744daec4cce23d335025cd5c213534c36e59a29e2aac4ecf749487ad73f855971a8431bbde514e295918177b6d07d253b901aaa28d8582 python-init.patch -57880dad0b7a939d6d5be57c4025966615ba95444ae1ba7a8bc25cdbc78202adf308fc452d52465ef0764c4a71383f61c6079fc8dfd57c6892501dc4c29a36da 0001-curl-multi-handle-timer_callback-correctly.patch -4b09e519e3a9b82cf36843a9483383a8c75763fc19b137a5bdf707db57543abd5193d70dd835d6155a6717ae9e4d577243fd25944322f42287a48465d7e98052 0002-curl-multi-fix-timer_callback-behavior-with-0-timeou.patch " -- GitLab