Skip to content

Commit

Permalink
- overhaul SystemAddress::SetBinaryAddress() to resolve multiple issu…
Browse files Browse the repository at this point in the history
…es (primarily in IPv4 mode - #263, #265)

- always try to determine the port in SystemAddress::FromString() if a delimiter is specified (IPv6 mode - #263)
- added missing WSAStartupSingleton::AddRef() in RakNetSocket2::DomainNameToIP() (#264)
- fix inconsistent 'g' vs. 'A' check in NonNumericHostString() (fixes #262)
- replace natpunch.jenkinssoftware.com with napunch.slikesoft.com throughout the code and consistently use natpunch.slikesoft.com (instead of slikesoft.com) (#173)
- dropped left over XBOX code (facebookarchive#130)
- code style, minor tweaks, whitespaces, and TODO markers (facebookarchive#130)
  • Loading branch information
Luke1410 committed Mar 25, 2019
1 parent 2872d3e commit b25662f
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 205 deletions.
4 changes: 2 additions & 2 deletions DependentExtensions/IrrlichtDemo/slikenetstuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2017-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2017-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -62,7 +62,7 @@ extern PlayerReplica *playerReplica; // Network object that represents the playe

// A NAT punchthrough and proxy server Jenkins Software is hosting for free, should usually be online
#define DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_PORT 61111
#define DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_IP "slikesoft.com"
#define DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_IP "natpunch.slikesoft.com"

void InstantiateRakNetClasses(void);
void DeinitializeRakNetClasses(void);
Expand Down
4 changes: 2 additions & 2 deletions Samples/AutopatcherClient/AutopatcherClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -230,7 +230,7 @@ int main(int argc, char **argv)
printf("Enter server IP: ");
Gets(buff,sizeof(buff));
if (buff[0]==0)
//strcpy_s(buff, "natpunch.jenkinssoftware.com");
//strcpy_s(buff, "natpunch.slikesoft.com");
strcpy_s(buff, "127.0.0.1");
}
else
Expand Down
4 changes: 2 additions & 2 deletions Samples/BigPacketTest/BigPacketTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -62,7 +62,7 @@ int main(void)
printf("Enter remote IP: ");
Gets(text,BIG_PACKET_SIZE);
if (text[0]==0)
strcpy_s(text, BIG_PACKET_SIZE, "slikesoft.com"); // dx in Europe
strcpy_s(text, BIG_PACKET_SIZE, "natpunch.slikesoft.com"); // dx in Europe
}
else if (ch=='s')
{
Expand Down
4 changes: 2 additions & 2 deletions Samples/ChatExample/Client/Chat Example Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -100,7 +100,7 @@ int main(void)
client->AllowConnectionResponseIPMigration(false);
if (ip[0]==0)
strcpy_s(ip, "127.0.0.1");
// strcpy_s(ip, "natpunch.jenkinssoftware.com");
// strcpy_s(ip, "natpunch.slikesoft.com");


puts("Enter the port to connect to");
Expand Down
4 changes: 2 additions & 2 deletions Samples/ComprehensivePCGame/ComprehensivePCGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -50,7 +50,7 @@

#define DEFAULT_SERVER_PORT "61111"
// Public test server
#define DEFAULT_SERVER_ADDRESS "slikesoft.com"
#define DEFAULT_SERVER_ADDRESS "natpunch.slikesoft.com"
#define NAT_TYPE_DETECTION_SERVER 0
#define USE_UPNP 1
#define MASTER_SERVER_ADDRESS "masterserver2.raknet.com"
Expand Down
4 changes: 2 additions & 2 deletions Samples/NATCompleteClient/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -44,7 +44,7 @@ using namespace SLNet;
#define DEFAULT_RAKPEER_PORT 50000
#define RAKPEER_PORT_STR "0"
#define DEFAULT_SERVER_PORT "61111"
#define DEFAULT_SERVER_ADDRESS "slikesoft.com"
#define DEFAULT_SERVER_ADDRESS "natpunch.slikesoft.com"

enum SampleResult
{
Expand Down
4 changes: 2 additions & 2 deletions Samples/PacketConsoleLogger/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -56,7 +56,7 @@ void main(void)
RakSleep(30);
}

SLNet::ConnectionAttemptResult car = rakPeer->Connect("slikesoft.com", 61111, 0, 0);
SLNet::ConnectionAttemptResult car = rakPeer->Connect("natpunch.slikesoft.com", 61111, 0, 0);
(void) car;
for(;;)
{
Expand Down
4 changes: 2 additions & 2 deletions Samples/RakVoice/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -168,7 +168,7 @@ int main(void)
printf("Enter IP of facilitator (enter for default): ");
Gets(facilitatorIP,sizeof(facilitatorIP));
if (facilitatorIP[0]==0)
strcpy_s(facilitatorIP, "slikesoft.com");
strcpy_s(facilitatorIP, "natpunch.slikesoft.com");
facilitator.FromString(facilitatorIP);
facilitator.SetPortHostOrder(NAT_PUNCHTHROUGH_FACILITATOR_PORT);
rakPeer->Connect(facilitatorIP, NAT_PUNCHTHROUGH_FACILITATOR_PORT, 0, 0);
Expand Down
4 changes: 2 additions & 2 deletions Samples/ReliableOrderedTest/ReliableOrderedTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -129,7 +129,7 @@ int main(int argc, char **argv)
Gets(ip, sizeof(ip));
if (ip[0]==0)
strcpy_s(ip, "127.0.0.1");
// strcpy_s(ip, "natpunch.jenkinssoftware.com");
// strcpy_s(ip, "natpunch.slikesoft.com");

printf("Enter remote port: ");
Gets(str, sizeof(str));
Expand Down
4 changes: 2 additions & 2 deletions Source/include/slikenet/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -148,7 +148,7 @@ struct RAK_DLL_EXPORT SocketDescriptor
char hostAddress[32];

/// IP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
/// IPV6 is the newer internet protocol. Instead of addresses such as natpunch.jenkinssoftware.com, you may have an address such as fe80::7c:31f7:fec4:27de%14.
/// IPV6 is the newer internet protocol. Instead of addresses such as natpunch.slikesoft.com, you may have an address such as fe80::7c:31f7:fec4:27de%14.
/// Encoding takes 16 bytes instead of 4, so IPV6 is less efficient for bandwidth.
/// On the positive side, NAT Punchthrough is not needed and should not be used with IPV6 because there are enough addresses that routers do not need to create address mappings.
/// RakPeer::Startup() will fail if this IP version is not supported.
Expand Down
1 change: 1 addition & 0 deletions Source/src/HTTPConnection2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ bool HTTPConnection2::TransmitRequest(const char* stringToTransmit, const char*
}
else
{
// #med - this should be changed to not extract the port from the passed in host-address (which is overwritten directly below with the provided port anyway)
if (request->hostEstimatedAddress.FromString(host, '|', ipVersion)==false)
{
SLNet::OP_DELETE(request, _FILE_AND_LINE_);
Expand Down
6 changes: 1 addition & 5 deletions Source/src/RakNetSocket2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2017-2018, SLikeSoft UG (haftungsbeschränkt)
* Modified work: Copyright (c) 2017-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
Expand Down Expand Up @@ -110,10 +110,6 @@ RNS2EventHandler * RakNetSocket2::GetEventHandler(void) const {return eventHandl
void RakNetSocket2::DomainNameToIP( const char *domainName, char ip[65] ) {
#if defined(WINDOWS_STORE_RT)
return RNS2_WindowsStore8::DomainNameToIP( domainName, ip );
#elif defined(__native_client__)
return DomainNameToIP_Berkley( domainName, ip );
#elif defined(_WIN32)
return DomainNameToIP_Berkley( domainName, ip );
#else
return DomainNameToIP_Berkley( domainName, ip );
#endif
Expand Down
4 changes: 4 additions & 0 deletions Source/src/RakNetSocket2_Berkley_NativeClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#if !defined(WINDOWS_STORE_RT)

#include "slikenet/Itoa.h"
#include "slikenet/WSAStartupSingleton.h" // used for WSAStartupSingleton

// Shared on most platforms, but excluded from the listed

Expand Down Expand Up @@ -78,7 +79,10 @@ void DomainNameToIP_Berkley_IPV4( const char *domainName, char ip[65] )
{
// Use inet_addr instead? What is the difference?
struct addrinfo *addressinfo = NULL;
// needed for getaddrinfo
WSAStartupSingleton::AddRef();
int error = getaddrinfo(domainName, NULL, NULL, &addressinfo);
WSAStartupSingleton::Deref();

if ( error != 0 || addressinfo == 0 )
{
Expand Down
Loading

0 comments on commit b25662f

Please sign in to comment.