Skip to content

Commit f04dd49

Browse files
committed
fixes for newer Boost
There were some API changes with the newer Boost library. This updates the code accordingly.
1 parent b5d0652 commit f04dd49

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/slic3r/GUI/FirmwareDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ void FirmwareDialog::priv::avr109_wait_for_bootloader(Avr109Pid usb_pid, unsigne
429429

430430
void FirmwareDialog::priv::avr109_reboot(const SerialPortInfo &port)
431431
{
432-
asio::io_service io;
432+
asio::io_context io;
433433
Serial serial(io, port.port, 1200);
434434
std::this_thread::sleep_for(std::chrono::milliseconds(50));
435435
}

src/slic3r/Utils/Bonjour.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ UdpSession::UdpSession(Bonjour::ReplyFn rfn) : replyfn(rfn)
624624
buffer.resize(DnsMessage::MAX_SIZE);
625625
}
626626

627-
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, const asio::ip::address& interface_address, std::shared_ptr< boost::asio::io_service > io_service)
627+
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, const asio::ip::address& interface_address, std::shared_ptr< boost::asio::io_context > io_service)
628628
: replyfn(replyfn)
629629
, multicast_address(multicast_address)
630630
, socket(*io_service)
@@ -658,7 +658,7 @@ UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multica
658658
}
659659

660660

661-
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, std::shared_ptr< boost::asio::io_service > io_service)
661+
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, std::shared_ptr< boost::asio::io_context > io_service)
662662
: replyfn(replyfn)
663663
, multicast_address(multicast_address)
664664
, socket(*io_service)
@@ -714,7 +714,7 @@ void UdpSocket::receive_handler(SharedSession session, const boost::system::erro
714714
// let io_service to handle the datagram on session
715715
// from boost documentation io_service::post:
716716
// The io_service guarantees that the handler will only be called in a thread in which the run(), run_one(), poll() or poll_one() member functions is currently being invoked.
717-
io_service->post(boost::bind(&UdpSession::handle_receive, session, error, bytes));
717+
boost::asio::post(io_service->get_executor(), boost::bind(&UdpSession::handle_receive, session, error, bytes));
718718
// immediately accept new datagrams
719719
async_receive();
720720
}
@@ -871,7 +871,7 @@ void Bonjour::priv::lookup_perform()
871871
{
872872
service_dn = (boost::format("_%1%._%2%.local") % service % protocol).str();
873873

874-
std::shared_ptr< boost::asio::io_service > io_service(new boost::asio::io_service);
874+
std::shared_ptr< boost::asio::io_context > io_service(new boost::asio::io_context);
875875

876876
std::vector<LookupSocket*> sockets;
877877

@@ -966,7 +966,7 @@ void Bonjour::priv::resolve_perform()
966966
rpls.push_back(reply);
967967
};
968968

969-
std::shared_ptr< boost::asio::io_service > io_service(new boost::asio::io_service);
969+
std::shared_ptr< boost::asio::io_context > io_service(new boost::asio::io_context);
970970
std::vector<ResolveSocket*> sockets;
971971

972972
// resolve interfaces - from PR#6646

src/slic3r/Utils/Bonjour.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ class UdpSocket
155155
UdpSocket(Bonjour::ReplyFn replyfn
156156
, const boost::asio::ip::address& multicast_address
157157
, const boost::asio::ip::address& interface_address
158-
, std::shared_ptr< boost::asio::io_service > io_service);
158+
, std::shared_ptr< boost::asio::io_context > io_service);
159159

160160
UdpSocket(Bonjour::ReplyFn replyfn
161161
, const boost::asio::ip::address& multicast_address
162-
, std::shared_ptr< boost::asio::io_service > io_service);
162+
, std::shared_ptr< boost::asio::io_context > io_service);
163163

164164
void send();
165165
void async_receive();
@@ -172,7 +172,7 @@ class UdpSocket
172172
boost::asio::ip::address multicast_address;
173173
boost::asio::ip::udp::socket socket;
174174
boost::asio::ip::udp::endpoint mcast_endpoint;
175-
std::shared_ptr< boost::asio::io_service > io_service;
175+
std::shared_ptr< boost::asio::io_context > io_service;
176176
std::vector<BonjourRequest> requests;
177177
};
178178

@@ -186,7 +186,7 @@ class LookupSocket : public UdpSocket
186186
, Bonjour::ReplyFn replyfn
187187
, const boost::asio::ip::address& multicast_address
188188
, const boost::asio::ip::address& interface_address
189-
, std::shared_ptr< boost::asio::io_service > io_service)
189+
, std::shared_ptr< boost::asio::io_context > io_service)
190190
: UdpSocket(replyfn, multicast_address, interface_address, io_service)
191191
, txt_keys(txt_keys)
192192
, service(service)
@@ -203,7 +203,7 @@ class LookupSocket : public UdpSocket
203203
, std::string protocol
204204
, Bonjour::ReplyFn replyfn
205205
, const boost::asio::ip::address& multicast_address
206-
, std::shared_ptr< boost::asio::io_service > io_service)
206+
, std::shared_ptr< boost::asio::io_context > io_service)
207207
: UdpSocket(replyfn, multicast_address, io_service)
208208
, txt_keys(txt_keys)
209209
, service(service)
@@ -241,7 +241,7 @@ class ResolveSocket : public UdpSocket
241241
, Bonjour::ReplyFn replyfn
242242
, const boost::asio::ip::address& multicast_address
243243
, const boost::asio::ip::address& interface_address
244-
, std::shared_ptr< boost::asio::io_service > io_service)
244+
, std::shared_ptr< boost::asio::io_context > io_service)
245245
: UdpSocket(replyfn, multicast_address, interface_address, io_service)
246246
, hostname(hostname)
247247

@@ -253,7 +253,7 @@ class ResolveSocket : public UdpSocket
253253
ResolveSocket(const std::string& hostname
254254
, Bonjour::ReplyFn replyfn
255255
, const boost::asio::ip::address& multicast_address
256-
, std::shared_ptr< boost::asio::io_service > io_service)
256+
, std::shared_ptr< boost::asio::io_context > io_service)
257257
: UdpSocket(replyfn, multicast_address, io_service)
258258
, hostname(hostname)
259259

src/slic3r/Utils/Serial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ std::vector<std::string> scan_serial_ports()
282282
namespace asio = boost::asio;
283283
using boost::system::error_code;
284284

285-
Serial::Serial(asio::io_service& io_service) :
285+
Serial::Serial(asio::io_context& io_service) :
286286
asio::serial_port(io_service)
287287
{}
288288

289-
Serial::Serial(asio::io_service& io_service, const std::string &name, unsigned baud_rate) :
289+
Serial::Serial(asio::io_context& io_service, const std::string &name, unsigned baud_rate) :
290290
asio::serial_port(io_service, name)
291291
{
292292
set_baud_rate(baud_rate);

src/slic3r/Utils/Serial.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ extern std::vector<SerialPortInfo> scan_serial_ports_extended();
4343
class Serial : public boost::asio::serial_port
4444
{
4545
public:
46-
Serial(boost::asio::io_service &io_service);
47-
Serial(boost::asio::io_service &io_service, const std::string &name, unsigned baud_rate);
46+
Serial(boost::asio::io_context &io_service);
47+
Serial(boost::asio::io_context &io_service, const std::string &name, unsigned baud_rate);
4848
Serial(const Serial &) = delete;
4949
Serial &operator=(const Serial &) = delete;
5050
~Serial();

src/slic3r/Utils/TCPConsole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ bool TCPConsole::run_queue()
161161

162162
auto endpoints = m_resolver.resolve(m_host_name, m_port_name);
163163

164-
m_socket.async_connect(endpoints->endpoint(),
164+
m_socket.async_connect(endpoints.begin()->endpoint(),
165165
boost::bind(&TCPConsole::handle_connect, this, boost::placeholders::_1)
166166
);
167167

0 commit comments

Comments
 (0)