mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge pull request #7606 from Robyt3/Base-TOS-Error-Fix
Avoid setting `IP_TOS` on IPv6 sockets on Windows, fix incorrect error code logged in socket warnings
This commit is contained in:
commit
f9dc1f5284
|
@ -1551,14 +1551,17 @@ NETSOCKET net_udp_create(NETADDR bindaddr)
|
|||
|
||||
/* set broadcast */
|
||||
if(setsockopt(socket, SOL_SOCKET, SO_BROADCAST, (const char *)&broadcast, sizeof(broadcast)) != 0)
|
||||
dbg_msg("socket", "Setting BROADCAST on ipv4 failed: %d", errno);
|
||||
{
|
||||
dbg_msg("socket", "Setting BROADCAST on ipv4 failed: %d", net_errno());
|
||||
}
|
||||
|
||||
{
|
||||
/* set DSCP/TOS */
|
||||
int iptos = 0x10 /* IPTOS_LOWDELAY */;
|
||||
//int iptos = 46; /* High Priority */
|
||||
if(setsockopt(socket, IPPROTO_IP, IP_TOS, (char *)&iptos, sizeof(iptos)) != 0)
|
||||
dbg_msg("socket", "Setting TOS on ipv4 failed: %d", errno);
|
||||
{
|
||||
dbg_msg("socket", "Setting TOS on ipv4 failed: %d", net_errno());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1596,15 +1599,21 @@ NETSOCKET net_udp_create(NETADDR bindaddr)
|
|||
|
||||
/* set broadcast */
|
||||
if(setsockopt(socket, SOL_SOCKET, SO_BROADCAST, (const char *)&broadcast, sizeof(broadcast)) != 0)
|
||||
dbg_msg("socket", "Setting BROADCAST on ipv6 failed: %d", errno);
|
||||
{
|
||||
dbg_msg("socket", "Setting BROADCAST on ipv6 failed: %d", net_errno());
|
||||
}
|
||||
|
||||
// TODO: setting IP_TOS on ipv6 with setsockopt is not supported on Windows, see https://github.com/ddnet/ddnet/issues/7605
|
||||
#if !defined(CONF_FAMILY_WINDOWS)
|
||||
{
|
||||
/* set DSCP/TOS */
|
||||
int iptos = 0x10 /* IPTOS_LOWDELAY */;
|
||||
//int iptos = 46; /* High Priority */
|
||||
if(setsockopt(socket, IPPROTO_IP, IP_TOS, (char *)&iptos, sizeof(iptos)) != 0)
|
||||
dbg_msg("socket", "Setting TOS on ipv6 failed: %d", errno);
|
||||
{
|
||||
dbg_msg("socket", "Setting TOS on ipv6 failed: %d", net_errno());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue