Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/nanocoh/naja
Browse files Browse the repository at this point in the history
  • Loading branch information
nanocoh committed Jan 6, 2025
2 parents 3701bd1 + 14785e0 commit 8f5cc76
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/snl/snl/serialization/capnp/SNLCapnP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ void SNLCapnP::send(const SNLDB* db, const std::string& ipAddress, uint16_t port
}

void SNLCapnP::send(const SNLDB* db, const std::string& ipAddress, uint16_t port, SNLID::DBID forceDBID) {
boost::asio::io_service io_service;
boost::asio::io_context ioContext;
//socket creation
tcp::socket socket(io_service);
socket.connect(tcp::endpoint(boost::asio::ip::address::from_string(ipAddress), port));
tcp::socket socket(ioContext);
socket.connect(tcp::endpoint(boost::asio::ip::make_address(ipAddress), port));
sendInterface(db, socket, forceDBID);
sendImplementation(db, socket, forceDBID);
}
Expand All @@ -42,11 +42,11 @@ SNLDB* SNLCapnP::load(const std::filesystem::path& path) {
//Need to find a proper way to test serialization on the wire
//LCOV_EXCL_START
boost::asio::ip::tcp::socket SNLCapnP::getSocket(uint16_t port) {
boost::asio::io_service io_service;
boost::asio::io_context ioContext;
//listen for new connection
tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v4(), port));
tcp::acceptor acceptor(ioContext, tcp::endpoint(tcp::v4(), port));
//socket creation
tcp::socket socket(io_service);
tcp::socket socket(ioContext);
//waiting for connection
acceptor.accept(socket);
return std::move(socket);
Expand Down
12 changes: 6 additions & 6 deletions src/snl/snl/serialization/capnp/SNLCapnPImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ void SNLCapnP::sendImplementation(
const SNLDB* db,
const std::string& ipAddress,
uint16_t port) {
boost::asio::io_service io_service;
boost::asio::io_context ioContext;
//socket creation
tcp::socket socket(io_service);
socket.connect(tcp::endpoint(boost::asio::ip::address::from_string(ipAddress), port));
tcp::socket socket(ioContext);
socket.connect(tcp::endpoint(boost::asio::ip::make_address(ipAddress), port));
sendImplementation(db, socket);
}
//LCOV_EXCL_STOP
Expand Down Expand Up @@ -555,11 +555,11 @@ SNLDB* SNLCapnP::receiveImplementation(tcp::socket& socket) {
}

SNLDB* SNLCapnP::receiveImplementation(uint16_t port) {
boost::asio::io_service io_service;
boost::asio::io_context ioContext;
//listen for new connection
tcp::acceptor acceptor_(io_service, tcp::endpoint(tcp::v4(), port));
tcp::acceptor acceptor_(ioContext, tcp::endpoint(tcp::v4(), port));
//socket creation
tcp::socket socket(io_service);
tcp::socket socket(ioContext);
//waiting for connection
acceptor_.accept(socket);
SNLDB* db = receiveImplementation(socket);
Expand Down
12 changes: 6 additions & 6 deletions src/snl/snl/serialization/capnp/SNLCapnPInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@ void SNLCapnP::sendInterface(
const SNLDB* db,
const std::string& ipAddress,
uint16_t port) {
boost::asio::io_service io_service;
boost::asio::io_context ioContext;
//socket creation
tcp::socket socket(io_service);
socket.connect(tcp::endpoint( boost::asio::ip::address::from_string(ipAddress), port));
tcp::socket socket(ioContext);
socket.connect(tcp::endpoint(boost::asio::ip::make_address(ipAddress), port));
sendInterface(db, socket);
}
//LCOV_EXCL_STOP
Expand Down Expand Up @@ -502,11 +502,11 @@ SNLDB* SNLCapnP::receiveInterface(tcp::socket& socket) {

//LCOV_EXCL_START
SNLDB* SNLCapnP::receiveInterface(uint16_t port) {
boost::asio::io_service io_service;
boost::asio::io_context ioContext;
//listen for new connection
tcp::acceptor acceptor_(io_service, tcp::endpoint(tcp::v4(), port));
tcp::acceptor acceptor_(ioContext, tcp::endpoint(tcp::v4(), port));
//socket creation
tcp::socket socket(io_service);
tcp::socket socket(ioContext);
//waiting for connection
acceptor_.accept(socket);
SNLDB* db = receiveInterface(socket);
Expand Down

0 comments on commit 8f5cc76

Please sign in to comment.