Avoid calling close when polling a UDP peer without socket

(cherry picked from commit e4b9b37ccf)
This commit is contained in:
Fabio Alessandrelli 2017-01-18 10:48:50 +01:00
parent ccf37c4ca2
commit aeffe74a27
2 changed files with 8 additions and 0 deletions

View file

@ -154,6 +154,10 @@ Error PacketPeerUDPPosix::wait() {
Error PacketPeerUDPPosix::_poll(bool p_wait) {
if (sockfd == -1) {
return FAILED;
}
struct sockaddr_storage from = { 0 };
socklen_t len = sizeof(struct sockaddr_storage);
int ret;

View file

@ -149,6 +149,10 @@ Error PacketPeerUDPWinsock::wait() {
}
Error PacketPeerUDPWinsock::_poll(bool p_wait) {
if (sockfd == -1) {
return FAILED;
}
_set_blocking(p_wait);
struct sockaddr_storage from = { 0 };