[arch-commits] Commit in restbed/trunk (PKGBUILD async_read_until.patch strand.patch)

Baptiste Jonglez zorun at archlinux.org
Fri Feb 2 07:44:48 UTC 2018


    Date: Friday, February 2, 2018 @ 07:44:48
  Author: zorun
Revision: 288532

restbed: update to 4.6+17+gdf867a8 for opendht

Added:
  restbed/trunk/async_read_until.patch
Modified:
  restbed/trunk/PKGBUILD
  restbed/trunk/strand.patch

------------------------+
 PKGBUILD               |   21 ++++----
 async_read_until.patch |  123 +++++++++++++++++++++++++++++++++++++++++++++++
 strand.patch           |   24 +++++++--
 3 files changed, 156 insertions(+), 12 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-02-02 06:11:37 UTC (rev 288531)
+++ PKGBUILD	2018-02-02 07:44:48 UTC (rev 288532)
@@ -1,7 +1,7 @@
 # Maintainer: Baptiste Jonglez <baptiste--aur at jonglez dot org>
 # Contributor: Justin Wilcox <nat1192 at gmail dot com>
 pkgname=restbed
-pkgver=4.6
+pkgver=4.6+17+gdf867a8
 pkgrel=1
 pkgdesc="A framework for asynchronous RESTful functionality in C++11 applications"
 arch=('x86_64')
@@ -11,20 +11,25 @@
 replaces=('restbed-latest')
 conflicts=('restbed-latest')
 makedepends=('cmake' 'asio' 'kashmir')
-source=("https://github.com/Corvusoft/restbed/archive/$pkgver/$pkgname-$pkgver.tar.gz"
-        "strand.patch")
-sha256sums=('36854390562c404ca5ac4f3be88ad2cf98b329e46c9a4286370990339d7eef2b'
-            '58ed74b3db6d989a871d181e6875226cef4e81f77dac6b9a45b04ae5d4e96299')
+_commit=df867a858dddc4cf6ca8642da02720bd65ba239a
+source=("https://github.com/Corvusoft/restbed/archive/${_commit}/$pkgname-$pkgver.tar.gz"
+        "strand.patch"
+        "async_read_until.patch")
+sha256sums=('0b752078d75e4d7f1e896bb208186bb65e2e558ea531c6a05a086c7e7504e060'
+            'a67baa5ffce44a851ba6bd47cbd04089665e52abc154b73063f51515e2094a51'
+            '9ba679d22448bb567766dccf58f98744cc90e0a851a5ccd37596bb4790396049')
 
 prepare() {
-  cd "$srcdir/$pkgname-$pkgver"
+  cd "$srcdir/$pkgname-$_commit"
 
   # Necessary to build against asio 1.10.X
   patch -p1 < "$srcdir"/strand.patch
+  # https://github.com/Corvusoft/restbed/pull/273
+  patch -p1 < "$srcdir"/async_read_until.patch
 }
 
 build() {
-  cd "$srcdir/$pkgname-$pkgver"
+  cd "$srcdir/$pkgname-$_commit"
 
   mkdir -p build
   cd build
@@ -36,7 +41,7 @@
 }
 
 package() {
-  cd "$srcdir/$pkgname-$pkgver"
+  cd "$srcdir/$pkgname-$_commit"
 
   cd build/
   make DESTDIR="$pkgdir" install

Added: async_read_until.patch
===================================================================
--- async_read_until.patch	                        (rev 0)
+++ async_read_until.patch	2018-02-02 07:44:48 UTC (rev 288532)
@@ -0,0 +1,123 @@
+From 09b542eea3fb3038d02ff056d41dea16bfe889bd Mon Sep 17 00:00:00 2001
+From: AmarOk <contact at enconn.fr>
+Date: Tue, 5 Dec 2017 10:45:53 -0600
+Subject: [PATCH]socket_impl: replace read_until by async_read_until
+
+---
+ source/corvusoft/restbed/detail/socket_impl.cpp | 62 +++++++++++++++++++------
+ 1 file changed, 49 insertions(+), 13 deletions(-)
+
+diff --git a/source/corvusoft/restbed/detail/socket_impl.cpp b/source/corvusoft/restbed/detail/socket_impl.cpp
+index 90e8b04..379f1c7 100644
+--- a/source/corvusoft/restbed/detail/socket_impl.cpp
++++ b/source/corvusoft/restbed/detail/socket_impl.cpp
+@@ -417,28 +417,47 @@ namespace restbed
+             m_timer->expires_from_now( m_timeout );
+             m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) );
+             
++
+             size_t size = 0;
++            auto finished = std::make_shared<bool>(false);
++            auto sharedError = std::make_shared<error_code>();
++            auto sharedSize = std::make_shared<size_t>(0);
++
+ #ifdef BUILD_SSL
+-            
++
+             if ( m_socket not_eq nullptr )
+             {
+ #endif
+-                size = asio::read( *m_socket, *data, asio::transfer_at_least( length ), error );
++                asio::async_read( *m_socket, *data, asio::transfer_at_least( length ),
++                    [ this, finished, sharedSize, sharedError ]( const error_code & error, size_t size ) {
++                        *sharedError = error;
++                        *sharedSize = size;
++                        *finished = true;
++                });
+ #ifdef BUILD_SSL
+             }
+             else
+             {
+-                size = asio::read( *m_ssl_socket, *data, asio::transfer_at_least( length ), error );
++                asio::async_read( *m_ssl_socket, *data, asio::transfer_at_least( length ),
++                    [ this, finished, sharedSize, sharedError ]( const error_code & error, size_t size ) {
++                        *sharedError = error;
++                        *sharedSize = size;
++                        *finished = true;
++                });
+             }
+-            
+ #endif
++            auto& io_service = m_socket->get_io_service( );
++            while (!*finished)
++                io_service.run_one();
++            error = *sharedError;
++            size = *sharedSize;
+             m_timer->cancel( );
+-            
++
+             if ( error )
+             {
+                 m_is_open = false;
+             }
+-            
++
+             return size;
+         }
+         
+@@ -549,28 +568,45 @@ namespace restbed
+             m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) );
+             
+             size_t length = 0;
+-            
++            auto finished = std::make_shared<bool>(false);
++            auto sharedError = std::make_shared<error_code>();
++            auto sharedLength = std::make_shared<size_t>(0);
++
+ #ifdef BUILD_SSL
+-            
++
+             if ( m_socket not_eq nullptr )
+             {
+ #endif
+-                length = asio::read_until( *m_socket, *data, delimiter, error );
++                asio::async_read_until( *m_socket, *data, delimiter,
++                    [ this, finished, sharedLength, sharedError ]( const error_code & error, size_t length ) {
++                        *sharedError = error;
++                        *sharedLength = length;
++                        *finished = true;
++                });
+ #ifdef BUILD_SSL
+             }
+             else
+             {
+-                length = asio::read_until( *m_ssl_socket, *data, delimiter, error );
++                asio::async_read_until( *m_ssl_socket, *data, delimiter,
++                    [ this, finished, sharedLength, sharedError ]( const error_code & error, size_t length ) {
++                        *sharedError = error;
++                        *sharedLength = length;
++                        *finished = true;
++                });
+             }
+-            
+ #endif
++            auto& io_service = m_socket->get_io_service( );
++            while (!*finished)
++                io_service.run_one();
++            error = *sharedError;
++            length = *sharedLength;
+             m_timer->cancel( );
+-            
++
+             if ( error )
+             {
+                 m_is_open = false;
+             }
+-            
++
+             return length;
+         }
+         
+-- 
+2.14.3
+

Modified: strand.patch
===================================================================
--- strand.patch	2018-02-02 06:11:37 UTC (rev 288531)
+++ strand.patch	2018-02-02 07:44:48 UTC (rev 288532)
@@ -1,8 +1,24 @@
---- a/source/corvusoft/restbed/detail/socket_impl.hpp	2016-09-28 12:01:30.415787179 -0400
---- a/source/corvusoft/restbed/detail/socket_impl.hpp	2016-09-28 12:01:33.329120391 -0400
-@@ -23,3 +23,3 @@
+From a330edb28151830aeaf08a71e42cb6618c25ef2f Mon Sep 17 00:00:00 2001
+From: Sébastien Blin <sebastiem.blin at savoirfairelinux.fr>
+Date: Tue, 5 Dec 2017 10:31:21 -0600
+Subject: [PATCH]update strand header for asio
+
+---
+ source/corvusoft/restbed/detail/socket_impl.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/source/corvusoft/restbed/detail/socket_impl.hpp b/source/corvusoft/restbed/detail/socket_impl.hpp
+index b10c3f7..02df572 100644
+--- a/source/corvusoft/restbed/detail/socket_impl.hpp
++++ b/source/corvusoft/restbed/detail/socket_impl.hpp
+@@ -23,7 +23,7 @@
+ #include <asio/streambuf.hpp>
+ #include <asio/steady_timer.hpp>
  #include <asio/io_service.hpp>
 -#include <asio/io_service_strand.hpp>
 +#include <asio/strand.hpp>
- 
 
+ #ifdef BUILD_SSL
+     #include <asio/ssl.hpp>
+--
+2.14.3



More information about the arch-commits mailing list