Disable resolv service on emscripten.

This commit is contained in:
Bartosz Taudul 2024-09-18 17:57:43 +02:00
parent 758080e579
commit 3bea3b7725
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -14,22 +14,28 @@
ResolvService::ResolvService( uint16_t port ) ResolvService::ResolvService( uint16_t port )
: m_exit( false ) : m_exit( false )
, m_port( port ) , m_port( port )
#ifndef __EMSCRIPTEN__
, m_thread( [this] { Worker(); } ) , m_thread( [this] { Worker(); } )
#endif
{ {
} }
ResolvService::~ResolvService() ResolvService::~ResolvService()
{ {
#ifndef __EMSCRIPTEN__
m_exit.store( true, std::memory_order_relaxed ); m_exit.store( true, std::memory_order_relaxed );
m_cv.notify_one(); m_cv.notify_one();
m_thread.join(); m_thread.join();
#endif
} }
void ResolvService::Query( uint32_t ip, const std::function<void(std::string&&)>& callback ) void ResolvService::Query( uint32_t ip, const std::function<void(std::string&&)>& callback )
{ {
#ifndef __EMSCRIPTEN__
std::lock_guard<std::mutex> lock( m_lock ); std::lock_guard<std::mutex> lock( m_lock );
m_queue.emplace_back( QueueItem { ip, callback } ); m_queue.emplace_back( QueueItem { ip, callback } );
m_cv.notify_one(); m_cv.notify_one();
#endif
} }
void ResolvService::Worker() void ResolvService::Worker()