Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
5bdbc0f7
Commit
5bdbc0f7
authored
Jan 22, 2017
by
Fabio Alessandrelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert ENetAddress host to 16 bytes to accomote IPv6
parent
4cc1b045
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
enet.h
thirdparty/enet/enet/enet.h
+14
-7
host.c
thirdparty/enet/host.c
+1
-1
protocol.c
thirdparty/enet/protocol.c
+4
-5
No files found.
thirdparty/enet/enet/enet.h
View file @
5bdbc0f7
...
...
@@ -12,11 +12,7 @@ extern "C"
#include <stdlib.h>
#ifdef _WIN32
#include "enet/win32.h"
#else
#include "enet/unix.h"
#endif
#include "enet/godot.h"
#include "enet/types.h"
#include "enet/protocol.h"
...
...
@@ -72,7 +68,6 @@ typedef enum _ENetSocketShutdown
ENET_SOCKET_SHUTDOWN_READ_WRITE
=
2
}
ENetSocketShutdown
;
#define ENET_HOST_ANY 0
#define ENET_HOST_BROADCAST 0xFFFFFFFFU
#define ENET_PORT_ANY 0
...
...
@@ -88,9 +83,11 @@ typedef enum _ENetSocketShutdown
*/
typedef
struct
_ENetAddress
{
enet_uint32
host
;
uint8_t
host
[
16
]
;
enet_uint16
port
;
uint8_t
wildcard
;
}
ENetAddress
;
#define enet_host_equal(host_a, host_b) (memcmp(&host_a, &host_b,16) == 0)
/**
* Packet flag bit constants.
...
...
@@ -519,6 +516,16 @@ ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSock
*/
ENET_API
int
enet_address_set_host
(
ENetAddress
*
address
,
const
char
*
hostName
);
/** Sets the host field in the address parameter from ip struct.
@param address destination to store resolved address
@param ip the ip struct to read from
@param size the size of the ip struct.
@retval 0 on success
@retval != 0 on failure
@returns the address of the given ip in address on success.
*/
ENET_API
void
enet_address_set_ip
(
ENetAddress
*
address
,
const
uint8_t
*
ip
,
size_t
size
);
/** Gives the printable form of the IP address specified in the address parameter.
@param address address printed
@param hostName destination for name, must not be NULL
...
...
thirdparty/enet/host.c
View file @
5bdbc0f7
...
...
@@ -87,7 +87,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
host
->
commandCount
=
0
;
host
->
bufferCount
=
0
;
host
->
checksum
=
NULL
;
host
->
receivedAddress
.
host
=
ENET_HOST_ANY
;
memset
(
host
->
receivedAddress
.
host
,
0
,
16
)
;
host
->
receivedAddress
.
port
=
0
;
host
->
receivedData
=
NULL
;
host
->
receivedDataLength
=
0
;
...
...
thirdparty/enet/protocol.c
View file @
5bdbc0f7
...
...
@@ -299,7 +299,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
}
else
if
(
currentPeer
->
state
!=
ENET_PEER_STATE_CONNECTING
&&
currentPeer
->
address
.
host
==
host
->
receivedAddress
.
host
)
enet_host_equal
(
currentPeer
->
address
.
host
,
host
->
receivedAddress
.
host
)
)
{
if
(
currentPeer
->
address
.
port
==
host
->
receivedAddress
.
port
&&
currentPeer
->
connectID
==
command
->
connect
.
connectID
)
...
...
@@ -1011,9 +1011,8 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
if
(
peer
->
state
==
ENET_PEER_STATE_DISCONNECTED
||
peer
->
state
==
ENET_PEER_STATE_ZOMBIE
||
((
host
->
receivedAddress
.
host
!=
peer
->
address
.
host
||
host
->
receivedAddress
.
port
!=
peer
->
address
.
port
)
&&
peer
->
address
.
host
!=
ENET_HOST_BROADCAST
)
||
(
!
enet_host_equal
(
host
->
receivedAddress
.
host
,
peer
->
address
.
host
)
||
host
->
receivedAddress
.
port
!=
peer
->
address
.
port
)
||
(
peer
->
outgoingPeerID
<
ENET_PROTOCOL_MAXIMUM_PEER_ID
&&
sessionID
!=
peer
->
incomingSessionID
))
return
0
;
...
...
@@ -1055,7 +1054,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
if
(
peer
!=
NULL
)
{
peer
->
address
.
host
=
host
->
receivedAddress
.
host
;
enet_address_set_ip
(
&
(
peer
->
address
),
host
->
receivedAddress
.
host
,
16
)
;
peer
->
address
.
port
=
host
->
receivedAddress
.
port
;
peer
->
incomingDataTotal
+=
host
->
receivedDataLength
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment