From 4d0ad9abb654d3b987148f024ffeb1a04da2b574 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 19 Mar 2014 23:10:34 -0700 Subject: Fix TRACE bug and new UDP socket code issue. --- node/PacketDecoder.cpp | 2 +- node/SocketManager.cpp | 6 ++++-- node/UdpSocket.cpp | 12 +++++------- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'node') diff --git a/node/PacketDecoder.cpp b/node/PacketDecoder.cpp index 59a4ee56..3f5979c5 100644 --- a/node/PacketDecoder.cpp +++ b/node/PacketDecoder.cpp @@ -609,7 +609,7 @@ bool PacketDecoder::_doMULTICAST_FRAME(const RuntimeEnvironment *_r,const Shared maxDepth = ZT_MULTICAST_GLOBAL_MAX_DEPTH; if (!network->isAllowed(origin)) { - TRACE("didn't inject MULTICAST_FRAME from %s(%s) into %.16llx: sender %s not allowed or we don't have a certificate",source().toString().c_str(),nwid,_remoteAddress.toString().c_str(),origin.toString().c_str()); + TRACE("didn't inject MULTICAST_FRAME from %s(%s) into %.16llx: sender %s not allowed or we don't have a certificate",source().toString().c_str(),_remoteAddress.toString().c_str(),nwid,origin.toString().c_str()); // Tell them we need a certificate Packet outp(source(),_r->identity.address(),Packet::VERB_ERROR); diff --git a/node/SocketManager.cpp b/node/SocketManager.cpp index 3c94f22c..c21b612f 100644 --- a/node/SocketManager.cpp +++ b/node/SocketManager.cpp @@ -422,10 +422,12 @@ void SocketManager::poll(unsigned long timeout) } } - if ((_udpV4Socket)&&(FD_ISSET(_udpV4Socket->_sock,&rfds))) + if ((_udpV4Socket)&&(FD_ISSET(_udpV4Socket->_sock,&rfds))) { _udpV4Socket->notifyAvailableForRead(_udpV4Socket,this); - if ((_udpV6Socket)&&(FD_ISSET(_udpV6Socket->_sock,&rfds))) + } + if ((_udpV6Socket)&&(FD_ISSET(_udpV6Socket->_sock,&rfds))) { _udpV6Socket->notifyAvailableForRead(_udpV6Socket,this); + } bool closedSockets = false; { // grab copy of TCP sockets list because _tcpSockets[] might be changed in a handler diff --git a/node/UdpSocket.cpp b/node/UdpSocket.cpp index 03041cf3..8730428f 100644 --- a/node/UdpSocket.cpp +++ b/node/UdpSocket.cpp @@ -93,13 +93,11 @@ bool UdpSocket::notifyAvailableForRead(const SharedPtr &self,SocketManag { Buffer 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; } -- cgit v1.2.3