1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Pass correct address size (ipv4,ipv6) to socket connect, bind, sendto

The address size passed to network system calls now reflects the the actual IP type (v4 or v6).
Fix Windows and OSX ipv6 sockets
This commit is contained in:
Fabio Alessandrelli
2016-10-22 07:23:07 +02:00
committed by Rémi Verschelde
parent a3131a6b5b
commit 80e911647c
7 changed files with 26 additions and 22 deletions

View File

@@ -87,11 +87,11 @@ Error TCPServerPosix::listen(uint16_t p_port, IP_Address::AddrType p_type, const
}
struct sockaddr_storage addr;
_set_listen_sockaddr(&addr, p_port, p_type, p_accepted_hosts);
size_t addr_size = _set_listen_sockaddr(&addr, p_port, p_type, p_accepted_hosts);
// automatically fill with my IP TODO: use p_accepted_hosts
if (bind(sockfd, (struct sockaddr *)&addr, sizeof addr) != -1) {
if (bind(sockfd, (struct sockaddr *)&addr, addr_size) != -1) {
if (::listen(sockfd, 1) == -1) {