You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +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:
committed by
Rémi Verschelde
parent
a3131a6b5b
commit
80e911647c
@@ -77,7 +77,7 @@ Error TCPServerWinsock::listen(uint16_t p_port, IP_Address::AddrType p_type,cons
|
||||
};
|
||||
|
||||
struct sockaddr_storage my_addr;
|
||||
_set_listen_sockaddr(&my_addr, p_port, p_type, p_accepted_hosts);
|
||||
size_t addr_size = _set_listen_sockaddr(&my_addr, p_port, p_type, p_accepted_hosts);
|
||||
|
||||
int reuse=1;
|
||||
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) {
|
||||
@@ -86,7 +86,7 @@ Error TCPServerWinsock::listen(uint16_t p_port, IP_Address::AddrType p_type,cons
|
||||
}
|
||||
|
||||
|
||||
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof my_addr) != SOCKET_ERROR) {
|
||||
if (bind(sockfd, (struct sockaddr *)&my_addr, addr_size) != SOCKET_ERROR) {
|
||||
|
||||
if (::listen(sockfd, SOMAXCONN) == SOCKET_ERROR) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user