aboutsummaryrefslogtreecommitdiff
path: root/drivers/unix/tcp_server_posix.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli2016-10-22 07:23:07 +0200
committerRémi Verschelde2016-10-26 08:20:31 +0200
commit80e911647c5df21c5b6a06876f1d48e21cd1f5fc (patch)
tree6fc3a52e19b24492bdcbf6e231ccb7b9fa536c42 /drivers/unix/tcp_server_posix.cpp
parenta3131a6b5bf5357e5c70ba6fea4a0963f4b341b4 (diff)
downloadgodot-80e911647c5df21c5b6a06876f1d48e21cd1f5fc.tar.gz
godot-80e911647c5df21c5b6a06876f1d48e21cd1f5fc.tar.zst
godot-80e911647c5df21c5b6a06876f1d48e21cd1f5fc.zip
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
Diffstat (limited to 'drivers/unix/tcp_server_posix.cpp')
-rw-r--r--drivers/unix/tcp_server_posix.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp
index 27c561847..05b739804 100644
--- a/drivers/unix/tcp_server_posix.cpp
+++ b/drivers/unix/tcp_server_posix.cpp
@@ -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) {