NetPlay: add a Common/ENetUtil namespace

Move WakeupThread in it
This commit is contained in:
mathieui
2015-03-09 18:37:02 +01:00
parent 603fe25349
commit 44d7207a1c
9 changed files with 53 additions and 41 deletions

View File

@ -0,0 +1,28 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "ENetUtil.h"
namespace ENetUtil
{
void 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);
}
}