@@ -297,33 +297,36 @@ namespace mdns
297297
298298 pplx::task<bool > register_address (const std::string& host_name, const std::string& ip_address, const std::string& domain, std::uint32_t interface_id) override
299299 {
300+ auto impl = this ;
300301 return pplx::create_task ([=]
301302 {
302303 // "Note: client is responsible for serializing access to these structures if
303304 // they are shared between concurrent threads."
304305 // See dns_sd.h
305- std::lock_guard<std::mutex> lock (mutex);
306- return mdns_details::register_address (client, host_name, ip_address, domain, interface_id, gate);
306+ std::lock_guard<std::mutex> lock (impl-> mutex );
307+ return mdns_details::register_address (impl-> client , host_name, ip_address, domain, interface_id, impl-> gate );
307308 });
308309 }
309310
310311 pplx::task<bool > register_service (const std::string& name, const std::string& type, std::uint16_t port, const std::string& domain, const std::string& host_name, const txt_records& txt_records) override
311312 {
313+ auto impl = this ;
312314 return pplx::create_task ([=]
313315 {
314316 // Lock also required here, for services
315- std::lock_guard<std::mutex> lock (mutex);
316- return mdns_details::register_service (services, name, type, port, domain, host_name, txt_records, gate);
317+ std::lock_guard<std::mutex> lock (impl-> mutex );
318+ return mdns_details::register_service (impl-> services , name, type, port, domain, host_name, txt_records, impl-> gate );
317319 });
318320 }
319321
320322 pplx::task<bool > update_record (const std::string& name, const std::string& type, const std::string& domain, const txt_records& txt_records) override
321323 {
324+ auto impl = this ;
322325 return pplx::create_task ([=]
323326 {
324327 // Lock also required here, for services
325- std::lock_guard<std::mutex> lock (mutex);
326- return mdns_details::update_record (services, name, type, domain, txt_records, gate);
328+ std::lock_guard<std::mutex> lock (impl-> mutex );
329+ return mdns_details::update_record (impl-> services , name, type, domain, txt_records, impl-> gate );
327330 });
328331 }
329332
0 commit comments