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)
+ size_t 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.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_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;
}