-// Written by Forest Hale 2003-06-15 and placed into public domain.
+// Written by Ashley Rose Hale (LadyHavoc) 2003-06-15 and placed into public domain.
#ifdef WIN32
#ifdef _MSC_VER
#endif
#ifndef STANDALONETEST
-#include "quakedef.h"
+#include "darkplaces.h"
#endif
#include <stdlib.h>
#include "lhnet.h"
#if defined(WIN32)
+// as of Visual Studio 2015, EWOULDBLOCK and ECONNREFUSED are real things, with different values than we want when talking to WinSock, so we have to undef them here or change the rest of the code.
+#undef EWOULDBLOCK
+#undef ECONNREFUSED
#define EWOULDBLOCK WSAEWOULDBLOCK
#define ECONNREFUSED WSAECONNREFUSED
#ifdef STANDALONETEST
if (i < MAX_NAMECACHE)
#else
- if (i < MAX_NAMECACHE && realtime < namecache[i].expirationtime)
+ if (i < MAX_NAMECACHE && host.realtime < namecache[i].expirationtime)
#endif
{
*address = namecache[i].address;
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
#ifndef STANDALONETEST
- namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
+ namecache[namecacheposition].expirationtime = host.realtime + 12 * 3600; // 12 hours
#endif
// try resolving the address (handles dns and other ip formats)
#ifdef STANDALONETEST
if (i < MAX_NAMECACHE)
#else
- if (i < MAX_NAMECACHE && realtime < namecache[i].expirationtime)
+ if (i < MAX_NAMECACHE && host.realtime < namecache[i].expirationtime)
#endif
{
*address = namecache[i].address;
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
#ifndef STANDALONETEST
- namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
+ namecache[namecacheposition].expirationtime = host.realtime + 12 * 3600; // 12 hours
#endif
namecache[namecacheposition].address = *address;
namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
#ifndef STANDALONETEST
- namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
+ namecache[namecacheposition].expirationtime = host.realtime + 12 * 3600; // 12 hours
#endif
namecache[namecacheposition].address = *address;
namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
#ifndef STANDALONETEST
- namecache[namecacheposition].expirationtime = realtime + 12 * 3600; // 12 hours
+ namecache[namecacheposition].expirationtime = host.realtime + 12 * 3600; // 12 hours
#endif
namecache[namecacheposition].address.addresstype = LHNETADDRESSTYPE_NONE;
namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
int rfc1149only = 0;
int rfc1149enabled = 0;
if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_1149ONLY, &rfc1149only))
- Con_Printf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError());
+ Con_Printf(CON_ERROR "LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError());
if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_ENABLED, &rfc1149enabled))
- Con_Printf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_ENABLED) returned error: %s\n", LHNETPRIVATE_StrError());
+ Con_Printf(CON_ERROR "LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_ENABLED) returned error: %s\n", LHNETPRIVATE_StrError());
}
#endif
continue;
}
#ifndef STANDALONETEST
- if (cl_netlocalping.value && (realtime - cl_netlocalping.value * (1.0 / 2000.0)) < p->sentdoubletime)
+ if (net_fakelag.value && (host.realtime - net_fakelag.value * (1.0 / 2000.0)) < p->sentdoubletime)
continue;
#endif
if (value == 0 && p->destinationport == lhnetsocket->address.port)
p->next->prev = p;
p->prev->next = p;
#ifndef STANDALONETEST
- p->sentdoubletime = realtime;
+ p->sentdoubletime = host.realtime;
#endif
value = contentlength;
}