Skip to content

Commit da6345b

Browse files
committed
fix: support asio 1.33
Asio changed `io_service`to `io_context` since 1.33
1 parent 72e5fa9 commit da6345b

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

include/cucumber-cpp/internal/connectors/wire/WireServer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CUCUMBER_CPP_EXPORT SocketServer {
2929

3030
protected:
3131
const ProtocolHandler* protocolHandler;
32-
asio::io_service ios;
32+
asio::io_context ios;
3333

3434
template<typename Protocol>
3535
void doListen(

src/connectors/wire/WireServer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ void SocketServer::doListen(
2323

2424
template<typename Protocol>
2525
void SocketServer::doAcceptOnce(asio::basic_socket_acceptor<Protocol>& acceptor) {
26-
typename Protocol::iostream stream;
27-
acceptor.accept(*stream.rdbuf());
26+
typename Protocol::socket socket(ios);
27+
acceptor.accept(socket);
28+
typename Protocol::iostream stream(std::move(socket));
2829
processStream(stream);
2930
}
3031

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void acceptWireProtocol(
3131
{
3232
TCPSocketServer* const tcpServer = new TCPSocketServer(&protocolHandler);
3333
server.reset(tcpServer);
34-
tcpServer->listen(asio::ip::tcp::endpoint(asio::ip::address::from_string(host), port));
34+
tcpServer->listen(asio::ip::tcp::endpoint(asio::ip::make_address(host), port));
3535
if (verbose)
3636
std::clog << "Listening on " << tcpServer->listenEndpoint() << std::endl;
3737
}

tests/integration/WireServerTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class TCPSocketServerLocalhostTest : public SocketServerTest {
141141

142142
SocketServer* createListeningServer() override {
143143
server.reset(new TCPSocketServer(&protocolHandler));
144-
server->listen(asio::ip::tcp::endpoint(asio::ip::address::from_string("127.0.0.1"), 0));
144+
server->listen(asio::ip::tcp::endpoint(asio::ip::make_address("127.0.0.1"), 0));
145145
return server.get();
146146
}
147147

0 commit comments

Comments
 (0)