Skip to content

get_io_service() #398

Closed
Closed

Description

@dsimog01

socket_.get_io_service() seems to be deprecated, so I can't run a server using crow.

Activity

  1. bastien8060 commented on Nov 13, 2021

    @bastien8060

    Hey, you seem to be talking about file socket_adaptors.h right?

  2. bastien8060 commented on Nov 13, 2021

    @bastien8060

    You can add a macro right after the includes:

    #if BOOST_VERSION >= 107000
    #define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
    #else
    #define GET_IO_SERVICE(s) ((s).get_io_service())
    #endif

    Then implement it. Replace:

            boost::asio::io_service& get_io_service()
            {
                return socket_.get_io_service();
            }

    with:

            boost::asio::io_service& get_io_service()
            {
                return GET_IO_SERVICE(socket_);
            }
  3. bastien8060 commented on Nov 13, 2021

    @bastien8060

    Another solution would be to use a fork. Because the maintainer of this repo is inactive, people forked it and took over the development. This one is our MVP: https://github.com/CrowCpp/crow

    Everything you need in there, including updates, and fixes. I recommend you use his fixes, updates and work, instead of the code here, which is outdated. The work made by the group CrowCpp is fantastic!

  4. dsimog01 commented on Nov 13, 2021

    @dsimog01
    Author

    I am amazed. So fast and so good. The first solution you provided worked.

  5. bastien8060 commented on Nov 13, 2021

    @bastien8060

    Ah, happy for you it worked! 👍

  6. dsimog01 commented on Nov 13, 2021

    @dsimog01
    Author

    I get some errors with the repo you told me. Any ideas?
    image

  7. bastien8060 commented on Nov 13, 2021

    @bastien8060

    Hmm, currently looking into it. Indeed, I can reproduce the same error as you. Will get back, with a solution shortly.

  8. The-EDev commented on Nov 13, 2021

    @The-EDev

    Hi, CrowCpp/Crow requires you add #define CROW_MAIN to the top of your main cpp file. This is to avoid multiple definitions when using multiple source files (We're working to remove the need for it however).

  9. dsimog01 commented on Nov 13, 2021

    @dsimog01
    Author

    It works! Thank you!

  10. bastien8060 commented on Nov 13, 2021

    @bastien8060

    Hi, CrowCpp/Crow requires you add #define CROW_MAIN to the top of your main cpp file. This is to avoid multiple definitions when using multiple source files (We're working to remove the need for it however).

    You beat me to it :). I had just found CrowCpp/Crow#150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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