Fix TRACE bug and new UDP socket code issue.

This commit is contained in:
Adam Ierymenko
2014-03-19 23:10:34 -07:00
parent 15e8c18106
commit 4d0ad9abb6
3 changed files with 10 additions and 10 deletions

View File

@ -93,13 +93,11 @@ bool UdpSocket::notifyAvailableForRead(const SharedPtr<Socket> &self,SocketManag
{
Buffer<ZT_SOCKET_MAX_MESSAGE_LEN> buf;
InetAddress from;
for(;;) {
socklen_t salen = from.saddrSpaceLen();
int n = (int)recvfrom(_sock,buf.data(),ZT_SOCKET_MAX_MESSAGE_LEN,0,from.saddr(),&salen);
if (n > 0) {
buf.setSize((unsigned int)n);
sm->handleReceivedPacket(self,from,buf);
} else break;
socklen_t salen = from.saddrSpaceLen();
int n = (int)recvfrom(_sock,buf.data(),ZT_SOCKET_MAX_MESSAGE_LEN,0,from.saddr(),&salen);
if (n > 0) {
buf.setSize((unsigned int)n);
sm->handleReceivedPacket(self,from,buf);
}
return true;
}