diff options
| author | Fabio Alessandrelli | 2017-03-08 17:14:01 +0100 |
|---|---|---|
| committer | Fabio Alessandrelli | 2017-03-24 02:30:11 +0100 |
| commit | 5f681d0b0f28cd39bc033c0cdf8eb3cb3a4acbe6 (patch) | |
| tree | 5c94a8cc2537076223598b4007943e436cf750b4 /thirdparty/enet/godot.cpp | |
| parent | 38d457170a15fd9eb902cecc8c5dc401646cd0b8 (diff) | |
| download | godot-5f681d0b0f28cd39bc033c0cdf8eb3cb3a4acbe6.tar.gz godot-5f681d0b0f28cd39bc033c0cdf8eb3cb3a4acbe6.tar.zst godot-5f681d0b0f28cd39bc033c0cdf8eb3cb3a4acbe6.zip | |
Diffstat (limited to 'thirdparty/enet/godot.cpp')
| -rw-r--r-- | thirdparty/enet/godot.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 0f707274e..18ccc02c5 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -79,7 +79,10 @@ int enet_socket_bind(ENetSocket socket, const ENetAddress *address) { ENetSocket enet_socket_create(ENetSocketType type) { - return PacketPeerUDP::create(); + PacketPeerUDP *socket = PacketPeerUDP::create(); + socket->set_blocking_mode(false); + + return socket; } void enet_socket_destroy(ENetSocket socket) { @@ -118,6 +121,11 @@ 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 + return 0; + } + WARN_PRINT("Sending failed!"); return -1; } |
