Skip to content

Mismatch between finished_handler_t and the actual handler function #112

@gammadean

Description

@gammadean

I'm trying to build using CMake with gcc 5.2 and Boost 1.58 and having a problem where the type definition for the handler doesn't match the actual function implementation and that causes a compiler error.

Specifically, http_server.cpp implements:
void server::handle_request(http::request_ptr& http_request_ptr, tcp::connection_ptr& tcp_conn, const boost::system::error_code& ec)

and binds it to a finished handler using:
my_reader_ptr = request_reader::create(tcp_conn, boost::bind(&server::handle_request, this, _1, _2, _3));

However, request_reader.hpp defines the finished_handler_t as:
typedef boost::function3<void, http::request_ptr, tcp::connection_ptr, const boost::system::error_code&> finished_handler_t;

Notice that server::handle_request has the 2nd and 3rd parameters defined as references but finished_handler_t does not. I can get rid of the error by modifying finished_handler_t to use references but I'm a lowly C programmer so I don't know if that's the correct solution. To further my doubt, the same problem is in tcp_server.cpp but the fix does not work there since the handler is eventually called using shared_from_this() and that causes an entirely different problem.

log.do_configure.txt

log.do_compile.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions