aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/Net/OVR_Unix_Socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'LibOVR/Src/Net/OVR_Unix_Socket.cpp')
-rw-r--r--LibOVR/Src/Net/OVR_Unix_Socket.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/LibOVR/Src/Net/OVR_Unix_Socket.cpp b/LibOVR/Src/Net/OVR_Unix_Socket.cpp
index 6370671..6f2a678 100644
--- a/LibOVR/Src/Net/OVR_Unix_Socket.cpp
+++ b/LibOVR/Src/Net/OVR_Unix_Socket.cpp
@@ -5,16 +5,16 @@ Content : Berkley sockets networking implementation
Created : July 1, 2014
Authors : Kevin Jenkins
-Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
+Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
-Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
+Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
-http://www.oculusvr.com/licenses/LICENSE-3.1
+http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
@@ -119,7 +119,6 @@ void SockAddr::Set(const char* hostAddress, UInt16 port, int sockType)
{
memset(&Addr6, 0, sizeof(Addr6));
- struct addrinfo* servinfo = 0; // will point to the results
struct addrinfo hints;
// make sure the struct is empty
@@ -138,6 +137,8 @@ void SockAddr::Set(const char* hostAddress, UInt16 port, int sockType)
hints.ai_protocol = IPPROTO_TCP;
}
+ struct addrinfo* servinfo = NULL; // will point to the results
+
char portStr[32];
OVR_itoa(port, portStr, sizeof(portStr), 10);
int errcode = getaddrinfo(hostAddress, portStr, &hints, &servinfo);
@@ -147,11 +148,14 @@ void SockAddr::Set(const char* hostAddress, UInt16 port, int sockType)
OVR::LogError("getaddrinfo error: %s", gai_strerror(errcode));
}
- OVR_ASSERT(0 != servinfo);
+ OVR_ASSERT(servinfo);
- memcpy(&Addr6, servinfo->ai_addr, sizeof(Addr6));
+ if (servinfo)
+ {
+ memcpy(&Addr6, servinfo->ai_addr, sizeof(Addr6));
- freeaddrinfo(servinfo);
+ freeaddrinfo(servinfo);
+ }
}
UInt16 SockAddr::GetPort()