Line data Source code
1 : //
2 : // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3 : //
4 : // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 : //
7 : // Official repository: https://github.com/cppalliance/beast2
8 : //
9 :
10 : #ifndef BOOST_BEAST2_SERVER_ROUTE_HANDLER_COROSIO_HPP
11 : #define BOOST_BEAST2_SERVER_ROUTE_HANDLER_COROSIO_HPP
12 :
13 : #include <boost/beast2/detail/config.hpp>
14 : #include <boost/http/server/route_handler.hpp>
15 : #include <boost/corosio/socket.hpp>
16 :
17 : namespace boost {
18 : namespace beast2 {
19 :
20 : /** Route parameters object for Corosio HTTP route handlers
21 : */
22 : class corosio_route_params
23 : : public http::route_params
24 : {
25 : public:
26 : using stream_type = corosio::socket;
27 :
28 : corosio::socket& stream;
29 :
30 : explicit
31 0 : corosio_route_params(
32 : corosio::socket& s)
33 0 : : stream(s)
34 : {
35 0 : }
36 :
37 : void do_finish()
38 : {
39 : if(finish_)
40 : {
41 : auto f = std::move(finish_);
42 : finish_ = {};
43 : f();
44 : }
45 : }
46 : };
47 :
48 : } // beast2
49 : } // boost
50 :
51 : #endif
|