summaryrefslogtreecommitdiff
path: root/thirdparty
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-08-31 03:22:41 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-09-12 12:50:53 +0200
commit7de28be76479796691730dcdc8c121543c5c9681 (patch)
tree1555f9d41b5ab9c136fe4e7d257783e2b2fd63af /thirdparty
parentd3108985e07d442aa90260b0830b3b46f9f4dcad (diff)
ENet wrapper properly detect disconnect on poll
Now PacketPeerUDP.get_available_packet_count() return -1 if the socket is in error state.
Diffstat (limited to 'thirdparty')
-rw-r--r--thirdparty/enet/godot.cpp5
1 files changed, 3 insertions, 2 deletions
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;