Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 3, 2010, 12:28:21 AM (14 years ago)
Author:
adrfried
Message:

patch libenet to support ipv6

This is only done for Linux so far.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ipv6/src/external/enet/protocol.c

    r7328 r7330  
    99#include "enet/time.h"
    1010#include "enet/enet.h"
     11
     12const ENetHostAddress ENET_HOST_ANY = { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } };
     13const ENetHostAddress ENET_HOST_BROADCAST = { { 0,0,0,0,0,0,0,0,0,0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
    1114
    1215static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] =
     
    263266    {
    264267        if (currentPeer -> state != ENET_PEER_STATE_DISCONNECTED &&
    265             currentPeer -> address.host == host -> receivedAddress.host &&
    266268            currentPeer -> address.port == host -> receivedAddress.port &&
    267             currentPeer -> connectID == command -> connect.connectID)
     269            currentPeer -> connectID == command -> connect.connectID &&
     270            !memcmp(& currentPeer -> address.host, & host -> receivedAddress.host, sizeof (ENetHostAddress)))
    268271          return NULL;
    269272    }
     
    849852       if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||
    850853           peer -> state == ENET_PEER_STATE_ZOMBIE ||
    851            (host -> receivedAddress.host != peer -> address.host &&
    852              peer -> address.host != ENET_HOST_BROADCAST) ||
    853854           (peer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID &&
    854             sessionID != peer -> incomingSessionID))
     855            sessionID != peer -> incomingSessionID) ||
     856           ( memcmp(& peer -> address.host, & host -> receivedAddress.host, sizeof (ENetHostAddress)) &&
     857             memcmp(& peer -> address.host, & ENET_HOST_BROADCAST, sizeof (ENetHostAddress)) &&
     858             peer -> address.host.addr[0] != 0xff ) )
    855859         return 0;
    856860    }
     
    892896    if (peer != NULL)
    893897    {
    894        peer -> address.host = host -> receivedAddress.host;
    895        peer -> address.port = host -> receivedAddress.port;
     898       peer -> address = host -> receivedAddress;
    896899       peer -> incomingDataTotal += host -> receivedDataLength;
    897900    }
Note: See TracChangeset for help on using the changeset viewer.