Skip to content

Commit b9de5d2

Browse files
committed
Merge branch 'master' into ipv6
Conflicts: unix.c
2 parents 3f5bab2 + a2eb357 commit b9de5d2

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2002-2014 Lee Salzman
1+
Copyright (c) 2002-2015 Lee Salzman
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

docs/license.dox

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
@page License License
33

4-
Copyright (c) 2002-2014 Lee Salzman
4+
Copyright (c) 2002-2015 Lee Salzman
55

66
Permission is hereby granted, free of charge, to any person obtaining
77
a copy of this software and associated documentation files (the

protocol.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN
764764

765765
if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0)
766766
peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE;
767+
else
768+
if (peer -> incomingBandwidth == 0 || host -> outgoingBandwidth == 0)
769+
peer -> windowSize = (ENET_MAX (peer -> incomingBandwidth, host -> outgoingBandwidth) /
770+
ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
767771
else
768772
peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) /
769773
ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE;
@@ -1486,7 +1490,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
14861490
! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
14871491
(channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
14881492
channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
1489-
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
1493+
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOWS - reliableWindow)))))
14901494
windowWrap = 1;
14911495
if (windowWrap)
14921496
{

unix.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ enet_address_set_host (ENetAddress * address, const char * name)
104104
char buffer [2048];
105105
int errnum;
106106

107-
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
107+
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
108108
gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
109109
#else
110110
hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum);
@@ -162,7 +162,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
162162

163163
in = address -> host;
164164

165-
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
165+
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
166166
gethostbyaddr_r ((char *) & in, sizeof (struct in6_addr), AF_INET6, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum);
167167
#else
168168
hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in6_addr), AF_INET6, & hostData, buffer, sizeof (buffer), & errnum);
@@ -246,7 +246,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
246246
{
247247
case ENET_SOCKOPT_NONBLOCK:
248248
#ifdef HAS_FCNTL
249-
result = fcntl (socket, F_SETFL, O_NONBLOCK | fcntl (socket, F_GETFL));
249+
result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK));
250250
#else
251251
result = ioctl (socket, FIONBIO, & value);
252252
#endif

0 commit comments

Comments
 (0)