diff options
Diffstat (limited to 'thirdparty/enet/godot.cpp')
-rw-r--r-- | thirdparty/enet/godot.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 7813b70286..6ba7cf0000 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -108,7 +108,7 @@ int enet_socket_bind(ENetSocket socket, const ENetAddress *address) { ENetSocket enet_socket_create(ENetSocketType type) { - PacketPeerUDP *socket = PacketPeerUDP::create(); + PacketPeerUDP *socket = memnew(PacketPeerUDP); socket->set_blocking_mode(false); return socket; @@ -151,7 +151,7 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu err = sock->put_packet((const uint8_t *)&w[0], size); if (err != OK) { - if (err == ERR_UNAVAILABLE) { // blocking call + if (err == ERR_BUSY) { // Blocking call return 0; } @@ -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; |