Remove enet modifications. Fixes #21.

This commit is contained in:
leper 2016-11-07 23:52:39 +01:00 committed by Deve
parent 154ad8d0db
commit 47dc4bdbaa
4 changed files with 12 additions and 4 deletions

View File

@ -49,7 +49,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
memset (host -> peers, 0, peerCount * sizeof (ENetPeer));
host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM);
if (host -> socket == ENET_SOCKET_NULL || (enet_socket_bind (host -> socket, address) < 0 && address != NULL))
if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0))
{
if (host -> socket != ENET_SOCKET_NULL)
enet_socket_destroy (host -> socket);

View File

@ -54,7 +54,7 @@ public:
Network(int peer_count, int channel_limit,
uint32_t max_incoming_bandwidth,
uint32_t max_outgoing_bandwidth,
ENetAddress* address = NULL);
ENetAddress* address);
virtual ~Network();
static void openLog();

View File

@ -23,6 +23,7 @@
#include "network/network_config.hpp"
#include "network/network_string.hpp"
#include "network/protocols/connect_to_server.hpp"
#include "network/stk_host.hpp"
#include "utils/log.hpp"
#include "utils/string_utils.hpp"
@ -115,7 +116,10 @@ void GetPublicAddress::createStunRequest()
m_stun_server_ip = ntohl(current_interface->sin_addr.s_addr);
// Create a new socket for the stun server.
m_transaction_host = new Network(1, 1, 0, 0);
ENetAddress addr;
addr.host = STKHost::HOST_ANY;
addr.port = STKHost::PORT_ANY;
m_transaction_host = new Network(1, 1, 0, 0, &addr);
// Assemble the message for the stun server
BareNetworkString s(20);

View File

@ -22,6 +22,7 @@
#include "network/network.hpp"
#include "network/network_config.hpp"
#include "network/network_string.hpp"
#include "network/stk_host.hpp"
#include "online/xml_request.hpp"
#include "utils/translation.hpp"
#include "utils/time.hpp"
@ -150,7 +151,10 @@ Online::XMLRequest* ServersManager::getLANRefreshRequest() const
// --------------------------------------------------------------------
virtual void operation() OVERRIDE
{
Network *broadcast = new Network(1, 1, 0, 0);
ENetAddress addr;
addr.host = STKHost::HOST_ANY;
addr.port = STKHost::PORT_ANY;
Network *broadcast = new Network(1, 1, 0, 0, &addr);
BareNetworkString s(std::string("stk-server"));
TransportAddress broadcast_address(-1,