|
@@ -70,6 +70,7 @@
|
|
#define SOCK_CBUF(x) x
|
|
#define SOCK_CBUF(x) x
|
|
#define SOCK_IOCTL ioctl
|
|
#define SOCK_IOCTL ioctl
|
|
#define SOCK_CLOSE ::close
|
|
#define SOCK_CLOSE ::close
|
|
|
|
+#define SOCK_CONNECT(p_sock, p_addr, p_addr_len) ::connect(p_sock, p_addr, p_addr_len)
|
|
|
|
|
|
/* Windows */
|
|
/* Windows */
|
|
#elif defined(WINDOWS_ENABLED)
|
|
#elif defined(WINDOWS_ENABLED)
|
|
@@ -83,6 +84,9 @@
|
|
#define SOCK_CBUF(x) (const char *)(x)
|
|
#define SOCK_CBUF(x) (const char *)(x)
|
|
#define SOCK_IOCTL ioctlsocket
|
|
#define SOCK_IOCTL ioctlsocket
|
|
#define SOCK_CLOSE closesocket
|
|
#define SOCK_CLOSE closesocket
|
|
|
|
+// connect is broken on windows under certain conditions, reasons unknown:
|
|
|
|
+// See https://github.com/godotengine/webrtc-native/issues/6
|
|
|
|
+#define SOCK_CONNECT(p_sock, p_addr, p_addr_len) ::WSAConnect(p_sock, p_addr, p_addr_len, NULL, NULL, NULL, NULL)
|
|
|
|
|
|
// Workaround missing flag in MinGW
|
|
// Workaround missing flag in MinGW
|
|
#if defined(__MINGW32__) && !defined(SIO_UDP_NETRESET)
|
|
#if defined(__MINGW32__) && !defined(SIO_UDP_NETRESET)
|
|
@@ -409,7 +413,7 @@ Error NetSocketPosix::connect_to_host(IP_Address p_host, uint16_t p_port) {
|
|
struct sockaddr_storage addr;
|
|
struct sockaddr_storage addr;
|
|
size_t addr_size = _set_addr_storage(&addr, p_host, p_port, _ip_type);
|
|
size_t addr_size = _set_addr_storage(&addr, p_host, p_port, _ip_type);
|
|
|
|
|
|
- if (::connect(_sock, (struct sockaddr *)&addr, addr_size) != 0) {
|
|
|
|
|
|
+ if (SOCK_CONNECT(_sock, (struct sockaddr *)&addr, addr_size) != 0) {
|
|
|
|
|
|
NetError err = _get_socket_error();
|
|
NetError err = _get_socket_error();
|
|
|
|
|