case LHNETADDRESSTYPE_INET4:
case LHNETADDRESSTYPE_INET6:
#ifdef WIN32
- if (!lhnet_didWSAStartup && !WSAStartup(MAKEWORD(1, 1), &lhnet_winsockdata))
- {
- lhnet_didWSAStartup = 1;
-#else
+ if (lhnet_didWSAStartup || (lhnet_didWSAStartup = !WSAStartup(MAKEWORD(1, 1), &lhnet_winsockdata)))
{
#endif
- if (address->addresstype == LHNETADDRESSTYPE_INET6)
- lhnetsocket->inetsocket = socket(LHNETADDRESSTYPE_INET6_FAMILY, SOCK_DGRAM, IPPROTO_UDP);
- else
- lhnetsocket->inetsocket = socket(LHNETADDRESSTYPE_INET4_FAMILY, SOCK_DGRAM, IPPROTO_UDP);
- if (lhnetsocket->inetsocket != -1)
+ if ((lhnetsocket->inetsocket = socket(address->addresstype == LHNETADDRESSTYPE_INET6 ? LHNETADDRESSTYPE_INET6_FAMILY : LHNETADDRESSTYPE_INET4_FAMILY, SOCK_DGRAM, IPPROTO_UDP)) != -1)
{
#ifdef WIN32
u_long _true = 1;
}
else
Con_Printf("LHNET_OpenSocket_Connectionless: socket returned error: %s\n", LHNETPRIVATE_StrError());
+#ifdef WIN32
}
+ else
+ Con_Print("LHNET_OpenSocket_Connectionless: WSAStartup failed\n");
+#endif
break;
default:
break;
switch (e)
{
case WSAECONNREFUSED:
- Con_Printf("Connection refused\n");
+ Con_Print("Connection refused\n");
return 0;
}
#else
switch (errno)
{
case ECONNREFUSED:
- Con_Printf("Connection refused\n");
+ Con_Print("Connection refused\n");
return 0;
}
#endif
switch (e)
{
case WSAECONNREFUSED:
- Con_Printf("Connection refused\n");
+ Con_Print("Connection refused\n");
return 0;
}
#else
switch (errno)
{
case ECONNREFUSED:
- Con_Printf("Connection refused\n");
+ Con_Print("Connection refused\n");
return 0;
}
#endif
p->next->prev = p;
p->prev->next = p;
#ifndef STANDALONETEST
- if (cl_fakelocalping_min.integer || cl_fakelocalping_max.integer)
- p->sentdoubletime = Sys_DoubleTime() + (cl_fakelocalping_min.integer + ((cl_fakelocalping_max.integer - cl_fakelocalping_min.integer) * (rand() & 255) / 256)) / 1000.0;
+ if (cl_fakelocalping_min.value || cl_fakelocalping_max.value)
+ p->sentdoubletime = Sys_DoubleTime() + lhrandom(cl_fakelocalping_min.value, cl_fakelocalping_max.value) * (0.5 / 1000.0);
#endif
value = contentlength;
}