summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/unix/packet_peer_udp_posix.cpp2
-rw-r--r--drivers/windows/packet_peer_udp_winsock.cpp2
-rw-r--r--thirdparty/enet/godot.cpp5
3 files changed, 5 insertions, 4 deletions
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp
index 1cb530420e..1c5456917b 100644
--- a/drivers/unix/packet_peer_udp_posix.cpp
+++ b/drivers/unix/packet_peer_udp_posix.cpp
@@ -61,7 +61,7 @@ int PacketPeerUDPPosix::get_available_packet_count() const {
Error err = const_cast<PacketPeerUDPPosix *>(this)->_poll(false);
if (err != OK)
- return 0;
+ return -1;
return queue_count;
}
diff --git a/drivers/windows/packet_peer_udp_winsock.cpp b/drivers/windows/packet_peer_udp_winsock.cpp
index f7c3637e7e..62a23bdf3f 100644
--- a/drivers/windows/packet_peer_udp_winsock.cpp
+++ b/drivers/windows/packet_peer_udp_winsock.cpp
@@ -42,7 +42,7 @@ int PacketPeerUDPWinsock::get_available_packet_count() const {
Error err = const_cast<PacketPeerUDPWinsock *>(this)->_poll(false);
if (err != OK)
- return 0;
+ return -1;
return queue_count;
}
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp
index 7813b70286..177848f96b 100644
--- a/thirdparty/enet/godot.cpp
+++ b/thirdparty/enet/godot.cpp
@@ -168,8 +168,9 @@ int enet_socket_receive(ENetSocket socket, ENetAddress *address, ENetBuffer *buf
PacketPeerUDP *sock = (PacketPeerUDP *)socket;
- if (sock->get_available_packet_count() == 0) {
- return 0;
+ int pc = sock->get_available_packet_count();
+ if (pc < 1) {
+ return pc;
}
const uint8_t *buffer;