Skip to content

Update deprecated asio io_service and query#1279

Merged
jcoupey merged 1 commit intoVROOM-Project:masterfrom
blegat:asio
Oct 16, 2025
Merged

Update deprecated asio io_service and query#1279
jcoupey merged 1 commit intoVROOM-Project:masterfrom
blegat:asio

Conversation

@blegat
Copy link
Copy Markdown
Contributor

@blegat blegat commented Jul 28, 2025

On ArchLinux, I get asio v1.34.2 in which io_service and query are not defined anymore so I get

$ make
g++ -MMD -MP -I. -std=c++20 -Wextra -Wpedantic -Wall -O3 -DASIO_STANDALONE -DUSE_ROUTING=true -D USE_LIBGLPK=true -c routing/http_wrapper.cpp -o routing/http_wrapper.o
routing/http_wrapper.cpp: In member function ‘std::string vroom::routing::HttpWrapper::send_then_receive(const std::string&) const’:
routing/http_wrapper.cpp:73:11: error: ‘io_service’ is not a member of ‘asio’; did you mean ‘use_service’?
   73 |     asio::io_service io_service;
      |           ^~~~~~~~~~
      |           use_service
routing/http_wrapper.cpp:75:21: error: ‘io_service’ was not declared in this scope
   75 |     tcp::resolver r(io_service);
      |                     ^~~~~~~~~~
routing/http_wrapper.cpp:77:26: error: ‘query’ in ‘asio::ip::tcp::resolver’ {aka ‘class asio::ip::basic_resolver<asio::ip::tcp>’} does not name a type
   77 |     const tcp::resolver::query q(_server.host, _server.port);
      |                          ^~~~~
routing/http_wrapper.cpp:80:32: error: ‘q’ was not declared in this scope
   80 |     asio::connect(s, r.resolve(q));
      |                                ^
routing/http_wrapper.cpp: In member function ‘std::string vroom::routing::HttpWrapper::ssl_send_then_receive(const std::string&) const’:
routing/http_wrapper.cpp:97:11: error: ‘io_service’ is not a member of ‘asio’; did you mean ‘use_service’?
   97 |     asio::io_service io_service;
      |           ^~~~~~~~~~
      |           use_service
routing/http_wrapper.cpp:100:52: error: ‘io_service’ was not declared in this scope
  100 |     asio::ssl::stream<asio::ip::tcp::socket> ssock(io_service, ctx);
      |                                                    ^~~~~~~~~~
routing/http_wrapper.cpp:104:26: error: ‘query’ in ‘asio::ip::tcp::resolver’ {aka ‘class asio::ip::basic_resolver<asio::ip::tcp>’} does not name a type
  104 |     const tcp::resolver::query q(_server.host, _server.port);
      |                          ^~~~~
routing/http_wrapper.cpp:106:51: error: ‘q’ was not declared in this scope
  106 |     asio::connect(ssock.lowest_layer(), r.resolve(q));
      |                                                   ^
make: *** [makefile:76: routing/http_wrapper.o] Error 1

This PR fixes the two issues.

Copy link
Copy Markdown
Collaborator

@jcoupey jcoupey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this and submitting a PR! The changes look quite straightforward, I'm just wondering if you've been able to test the ssl version somehow?

@jcoupey jcoupey added this to the v1.15.0 milestone Sep 1, 2025
@blegat
Copy link
Copy Markdown
Contributor Author

blegat commented Sep 2, 2025

I've been able to compile and use the version of this PR but I don't believe to have hit these specific code path in the executions. Are there tests I could run to verify ?

@jcoupey
Copy link
Copy Markdown
Collaborator

jcoupey commented Sep 2, 2025

If you've been using locally, chances are you've been doing the requests over http so you went through HttpWrapper::send_then_receive. The HttpWrapper::ssl_send_then_receive version has been introduced to handle https connections, and we just switch version based on the port being used.

I guess the easiest test would be to run an existing demo endpoint from a routing engine that supports https, e.g. routing.openstreetmap.de for OSRM.

@jcoupey jcoupey merged commit 620c98c into VROOM-Project:master Oct 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants