mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-04-20 01:01:10 -05:00
NetPlay: add a Common/ENetUtil namespace
Move WakeupThread in it
This commit is contained in:
@@ -485,25 +485,7 @@ void NetPlayClient::RunOnThread(std::function<void()> func)
|
||||
std::lock_guard<std::recursive_mutex> lkq(m_crit.run_queue_write);
|
||||
m_run_queue.Push(func);
|
||||
}
|
||||
WakeupThread(m_client);
|
||||
}
|
||||
|
||||
void NetPlayClient::WakeupThread(ENetHost* host)
|
||||
{
|
||||
// Send ourselves a spurious message. This is hackier than it should be.
|
||||
// comex reported this as https://github.com/lsalzman/enet/issues/23, so
|
||||
// hopefully there will be a better way to do it in the future.
|
||||
ENetAddress address;
|
||||
if (host->address.port != 0)
|
||||
address.port = host->address.port;
|
||||
else
|
||||
enet_socket_get_address(host->socket, &address);
|
||||
address.host = 0x0100007f; // localhost
|
||||
u8 byte = 0;
|
||||
ENetBuffer buf;
|
||||
buf.data = &byte;
|
||||
buf.dataLength = 1;
|
||||
enet_socket_send(host->socket, &address, &buf, 1);
|
||||
ENetUtil::WakeupThread(m_client);
|
||||
}
|
||||
|
||||
// called from ---NETPLAY--- thread
|
||||
|
||||
Reference in New Issue
Block a user