socket-default: Make sure sockets are open when checking with FD_ISSET

This commit is contained in:
Tobias Brunner
2013-06-14 17:25:16 +02:00
parent 1889837767
commit c6f1929a45
@@ -192,22 +192,22 @@ METHOD(socket_t, receiver, status_t,
} }
thread_cancelability(oldstate); thread_cancelability(oldstate);
if (FD_ISSET(this->ipv4, &rfds)) if (this->ipv4 != -1 && FD_ISSET(this->ipv4, &rfds))
{ {
port = this->port; port = this->port;
selected = this->ipv4; selected = this->ipv4;
} }
if (FD_ISSET(this->ipv4_natt, &rfds)) if (this->ipv4_natt != -1 && FD_ISSET(this->ipv4_natt, &rfds))
{ {
port = this->natt; port = this->natt;
selected = this->ipv4_natt; selected = this->ipv4_natt;
} }
if (FD_ISSET(this->ipv6, &rfds)) if (this->ipv6 != -1 && FD_ISSET(this->ipv6, &rfds))
{ {
port = this->port; port = this->port;
selected = this->ipv6; selected = this->ipv6;
} }
if (FD_ISSET(this->ipv6_natt, &rfds)) if (this->ipv6_natt != -1 && FD_ISSET(this->ipv6_natt, &rfds))
{ {
port = this->natt; port = this->natt;
selected = this->ipv6_natt; selected = this->ipv6_natt;