Issue #2058 - apply additional patches from dbsoft for OS defines

This commit is contained in:
Basilisk-Dev 2023-08-31 08:44:34 -04:00 • committed by roytam1
commit 0e0bd83fe2
2 changed files with 8 additions and 8 deletions

View file

@ -97,7 +97,7 @@ class TransportTestPeer : public sigslot::has_slots<> {
memset(&local_addr_, 0, sizeof(local_addr_)); memset(&local_addr_, 0, sizeof(local_addr_));
local_addr_.sconn_family = AF_CONN; local_addr_.sconn_family = AF_CONN;
#if !defined(__Userspace_os_Linux) && !defined(__Userspace_os_Windows) && !defined(__Userspace_os_Android) #if !defined(__linux__) && !defined(_WIN32) && !defined(__ANDROID__)
local_addr_.sconn_len = sizeof(struct sockaddr_conn); local_addr_.sconn_len = sizeof(struct sockaddr_conn);
#endif #endif
local_addr_.sconn_port = htons(local_port); local_addr_.sconn_port = htons(local_port);
@ -106,7 +106,7 @@ class TransportTestPeer : public sigslot::has_slots<> {
memset(&remote_addr_, 0, sizeof(remote_addr_)); memset(&remote_addr_, 0, sizeof(remote_addr_));
remote_addr_.sconn_family = AF_CONN; remote_addr_.sconn_family = AF_CONN;
#if !defined(__Userspace_os_Linux) && !defined(__Userspace_os_Windows) && !defined(__Userspace_os_Android) #if !defined(__linux__) && !defined(_WIN32) && !defined(__ANDROID__)
remote_addr_.sconn_len = sizeof(struct sockaddr_conn); remote_addr_.sconn_len = sizeof(struct sockaddr_conn);
#endif #endif
remote_addr_.sconn_port = htons(remote_port); remote_addr_.sconn_port = htons(remote_port);

View file

@ -6,7 +6,7 @@
#include <algorithm> #include <algorithm>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if !defined(__Userspace_os_Windows) #if !defined(_WIN32)
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
// usrsctp.h expects to have errno definitions prior to its inclusion. // usrsctp.h expects to have errno definitions prior to its inclusion.
@ -547,7 +547,7 @@ DataChannelConnection::CompleteConnect(TransportFlow *flow, TransportLayer::Stat
struct sockaddr_conn addr; struct sockaddr_conn addr;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sconn_family = AF_CONN; addr.sconn_family = AF_CONN;
#if defined(__Userspace_os_Darwin) #if defined(__APPLE__)
addr.sconn_len = sizeof(addr); addr.sconn_len = sizeof(addr);
#endif #endif
addr.sconn_port = htons(mLocalPort); addr.sconn_port = htons(mLocalPort);
@ -801,7 +801,7 @@ DataChannelConnection::Connect(const char *addr, unsigned short port)
addr6.sin6_port = htons(port); addr6.sin6_port = htons(port);
mState = CONNECTING; mState = CONNECTING;
#if !defined(__Userspace_os_Windows) #if !defined(_WIN32)
if (inet_pton(AF_INET6, addr, &addr6.sin6_addr) == 1) { if (inet_pton(AF_INET6, addr, &addr6.sin6_addr) == 1) {
if (usrsctp_connect(mMasterSocket, reinterpret_cast<struct sockaddr *>(&addr6), sizeof(struct sockaddr_in6)) < 0) { if (usrsctp_connect(mMasterSocket, reinterpret_cast<struct sockaddr *>(&addr6), sizeof(struct sockaddr_in6)) < 0) {
LOG(("*** Failed userspace_connect")); LOG(("*** Failed userspace_connect"));
@ -1555,7 +1555,7 @@ void
DataChannelConnection::HandlePeerAddressChangeEvent(const struct sctp_paddr_change *spc) DataChannelConnection::HandlePeerAddressChangeEvent(const struct sctp_paddr_change *spc)
{ {
const char *addr = ""; const char *addr = "";
#if !defined(__Userspace_os_Windows) #if !defined(_WIN32)
char addr_buf[INET6_ADDRSTRLEN]; char addr_buf[INET6_ADDRSTRLEN];
struct sockaddr_in *sin; struct sockaddr_in *sin;
struct sockaddr_in6 *sin6; struct sockaddr_in6 *sin6;
@ -1563,13 +1563,13 @@ DataChannelConnection::HandlePeerAddressChangeEvent(const struct sctp_paddr_chan
switch (spc->spc_aaddr.ss_family) { switch (spc->spc_aaddr.ss_family) {
case AF_INET: case AF_INET:
#if !defined(__Userspace_os_Windows) #if !defined(_WIN32)
sin = (struct sockaddr_in *)&spc->spc_aaddr; sin = (struct sockaddr_in *)&spc->spc_aaddr;
addr = inet_ntop(AF_INET, &sin->sin_addr, addr_buf, INET6_ADDRSTRLEN); addr = inet_ntop(AF_INET, &sin->sin_addr, addr_buf, INET6_ADDRSTRLEN);
#endif #endif
break; break;
case AF_INET6: case AF_INET6:
#if !defined(__Userspace_os_Windows) #if !defined(_WIN32)
sin6 = (struct sockaddr_in6 *)&spc->spc_aaddr; sin6 = (struct sockaddr_in6 *)&spc->spc_aaddr;
addr = inet_ntop(AF_INET6, &sin6->sin6_addr, addr_buf, INET6_ADDRSTRLEN); addr = inet_ntop(AF_INET6, &sin6->sin6_addr, addr_buf, INET6_ADDRSTRLEN);
#endif #endif