#include "sys.h"
#include "netconn.h"
#else
+#define Con_Print printf
+#define Con_Printf printf
#define Z_Malloc malloc
#define Z_Free free
#endif
if (ioctl(lhnetsocket->inetsocket, FIONBIO, &_true) != -1)
#endif
{
- if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4)) != -1)
+#ifdef WIN32
+ int namelen;
+#else
+ socklen_t namelen;
+#endif
+ namelen = address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4);
+ if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, namelen) != -1)
{
+ getsockname(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, &namelen);
lhnetsocket->next = &lhnet_socketlist;
lhnetsocket->prev = lhnetsocket->next->prev;
lhnetsocket->next->prev = lhnetsocket;
#ifdef WIN32
}
else
- Con_Printf("LHNET_OpenSocket_Connectionless: WSAStartup failed\n");
+ Con_Print("LHNET_OpenSocket_Connectionless: WSAStartup failed\n");
#endif
break;
default:
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.value || cl_fakelocalping_max.value)
- p->sentdoubletime = Sys_DoubleTime() + lhrandom(cl_fakelocalping_min.value, cl_fakelocalping_max.value) * (0.5 / 1000.0);
+ if (cl_netlocalping_min.value || cl_netlocalping_max.value)
+ p->sentdoubletime = Sys_DoubleTime() + lhrandom(cl_netlocalping_min.value, cl_netlocalping_max.value) * (0.5 / 1000.0);
#endif
value = contentlength;
}