summaryrefslogtreecommitdiffstats
path: root/platform/windows/packet_peer_udp_winsock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/packet_peer_udp_winsock.cpp')
-rw-r--r--platform/windows/packet_peer_udp_winsock.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp
index 53524f807f..bad967eedd 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/platform/windows/packet_peer_udp_winsock.cpp
@@ -53,12 +53,14 @@ Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer,int &r_buffer_si
uint32_t size;
uint8_t type;
rb.read(&type, 1, true);
- if (type == IP_Address::TYPE_IPV4) {
- rb.read((uint8_t*)&packet_ip.field8,4,true);
- packet_ip.type = IP_Address::TYPE_IPV4;
+ if (type == IP::TYPE_IPV4) {
+ uint8_t ip[4];
+ rb.read(ip,4,true);
+ packet_ip.set_ipv4(ip);
} else {
- rb.read((uint8_t*)&packet_ip.field8,16,true);
- packet_ip.type = IP_Address::TYPE_IPV6;
+ uint8_t ip[16];
+ rb.read(ip,16,true);
+ packet_ip.set_ipv6(ip);
};
rb.read((uint8_t*)&packet_port,4,true);
rb.read((uint8_t*)&size,4,true);
@@ -162,7 +164,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
uint32_t port = 0;
if (from.ss_family == AF_INET) {
- uint8_t type = (uint8_t)IP_Address::TYPE_IPV4;
+ uint8_t type = (uint8_t)IP::TYPE_IPV4;
rb.write(&type, 1);
struct sockaddr_in* sin_from = (struct sockaddr_in*)&from;
rb.write((uint8_t*)&sin_from->sin_addr, 4);
@@ -170,7 +172,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
} else if (from.ss_family == AF_INET6) {
- uint8_t type = (uint8_t)IP_Address::TYPE_IPV6;
+ uint8_t type = (uint8_t)IP::TYPE_IPV6;
rb.write(&type, 1);
struct sockaddr_in6* s6_from = (struct sockaddr_in6*)&from;
@@ -180,7 +182,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
} else {
// WARN_PRINT("Ignoring packet with unknown address family");
- uint8_t type = (uint8_t)IP_Address::TYPE_NONE;
+ uint8_t type = (uint8_t)IP::TYPE_NONE;
rb.write(&type, 1);
};