Windows libraries for getaddrinfo
[carveJwlIkooP6JGAAIwe30JlM.git] / network.c
index 4c9c61afd7424fb9e5d9fd66da47cacc3851e390..fdec386ccd62f0e884414ea860f5f28c4df67612 100644 (file)
--- a/network.c
+++ b/network.c
 #include "ent_region.h"
 #include "vg/vg_loader.h"
 
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
+#ifdef _WIN32
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+#else
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <netdb.h>
+#endif
 
 struct network_client network_client =
 {
@@ -613,7 +618,22 @@ static void network_resolve_host_thread( void *_ )
                         &hints, &result);
    if( s != 0 ) 
    {
+#ifndef _WIN32
       vg_error( "getaddrinfo: %s\n", gai_strerror(s) );
+#endif
+
+      if( !strcmp( network_client.host_adress, "skaterift.com" ) )
+      {
+         vg_warn( "getaddrinfo failed for skaterift.com;\n "
+                  "falling back to a hardcoded IPv4\n" );
+         strcpy( network_client.host_adress, "46.101.34.155" );
+         SteamAPI_SteamNetworkingIPAddr_ParseString( 
+               &network_client.ip, 
+               network_client.host_adress );
+         network_client.ip.m_port = NETWORK_PORT;
+         *status = 1;
+      }
+
       goto end;
    }