Boost logo

Boost-Commit :

From: lists.drrngrvy_at_[hidden]
Date: 2008-03-28 18:10:40


Author: drrngrvy
Date: 2008-03-28 18:10:40 EDT (Fri, 28 Mar 2008)
New Revision: 43918
URL: http://svn.boost.org/trac/boost/changeset/43918

Log:
Tiny addition moving towards an async_load function.
Text files modified:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp | 13 +++++++------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp | 25 +------------------------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp | 40 +++++++++++++++++++++++++++++++++++++++-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp | 4 ++--
   4 files changed, 49 insertions(+), 33 deletions(-)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp 2008-03-28 18:10:40 EDT (Fri, 28 Mar 2008)
@@ -188,16 +188,17 @@
     }
 
 
+ // **FIXME**
     /// Asynchronously read/parse the request meta-data
     /**
      * Note: 'loading' including reading/parsing STDIN if parse_stdin == true
      */
- template<typename Handler>
- void async_load(Handler handler, bool parse_stdin = false)
- {
- this->service.async_load(this->implementation, parse_stdin
- , handler);
- }
+ //template<typename Handler>
+ //void async_load(Handler handler, bool parse_stdin = false)
+ //{
+ // this->service.async_load(this->implementation, parse_stdin
+ // , handler);
+ //}
 
     /// Notify the server the request has finished being handled
     /**

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp 2008-03-28 18:10:40 EDT (Fri, 28 Mar 2008)
@@ -34,7 +34,7 @@
    namespace detail {
 
      /// Helper functions for async_accept operation.
- template<typename T, /*typename Request, */typename Handler>
+ template<typename T, typename Handler>
      struct accept_handler
      {
        accept_handler(T& t, typename T::implementation_type& impl
@@ -297,17 +297,6 @@
        this->io_service().post(
          detail::accept_handler<type, Handler>(*this, impl, request, handler)
        );
- //boost::system::error_code ec;
- //handler(ec);
- //acceptor_service_.async_accept(impl.acceptor_, request.client().connection()->next_layer_type()
-
-/*
- &acceptor_service_impl<protocol_type>
- ::typename check_for_waiting_request<
- CommonGatewayRequest
- , Handler>,
- this, boost::ref(impl), boost::ref(request), handler));
-*/
      }
 
      /// Close the acceptor (not implemented yet).
@@ -329,18 +318,6 @@
                                    , CommonGatewayRequest& request
                                    , Handler handler)
      {
- /*
- {
- boost::mutex::scoped_lock lk(impl.mutex_);
- if (!impl.waiting_requests_.empty())
- {
- request = *(impl.waiting_requests_.front());
- impl.waiting_requests_.pop();
- return handler(ec); // this could be `io_service::post`ed again
- }
- }
- */
-
        // We can't call accept on an open request (close it first).
        if (request.is_open())
          return handler(error::accepting_on_an_open_request);

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp 2008-03-28 18:10:40 EDT (Fri, 28 Mar 2008)
@@ -24,8 +24,37 @@
 #include "boost/cgi/fcgi/client.hpp"
 
 namespace cgi {
- namespace fcgi {
 
+ namespace detail {
+
+ template<typename T, typename Handler>
+ struct async_load_helper
+ {
+ async_load_helper(T& t, typename T::implementation_type& impl
+ , bool parse_stdin, Handler h)
+ : type(t)
+ , impl_(impl)
+ , parse_stdin_(parse_stdin)
+ , handler_(h)
+ {
+ }
+
+ void operator()()
+ {
+ boost::system::error_code ec;
+ type.load(impl_, parse_stdin_, ec);
+ handler_(ec);
+ }
+
+ T& type;
+ typename T::implementation_type& impl_;
+ bool parse_stdin_;
+ Handler handler_;
+ };
+ }
+
+ namespace fcgi {
+
   /// The IoObjectService class for a FCGI basic_request<>s
   class fcgi_request_service
     : public detail::service_base<fcgi_request_service>
@@ -276,6 +305,15 @@
       return ec;
     }
 
+ // **FIXME**
+ template<typename Handler>
+ void async_load(implementation_type& impl, bool parse_stdin, Handler handler)
+ {
+ this->io_service().post(
+ detail::async_load_helper<type, Handler>(this, parse_stdin, handler)
+ );
+ }
+
     /* These Don't Belong Here.
     template<typename MutableBufferSequence>
     std::size_t read_some(implementation_type& impl

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp 2008-03-28 18:10:40 EDT (Fri, 28 Mar 2008)
@@ -58,7 +58,7 @@
     {
     }
 
- ::cgi::io_service&
+ ::cgi::common::io_service&
       get_io_service()
     {
       return io_service_;
@@ -79,7 +79,7 @@
       io_service_.reset();
     }
   private:
- ::cgi::io_service io_service_;
+ ::cgi::common::io_service io_service_;
   };
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk