Allow (and forward) zero-byte UDP packets.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 16 Oct 2019 16:56:14 +0000 (18:56 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 16 Oct 2019 16:56:14 +0000 (18:56 +0200)
udpinput.cpp

index a2915e8..4b421a3 100644 (file)
@@ -210,7 +210,7 @@ void UDPInput::do_work()
                        ret = recv(sock, packet_buf, sizeof(packet_buf), 0);
                } while (ret == -1 && errno == EINTR);
 
-               if (ret <= 0) {
+               if (ret < 0) {  // Note that zero-byte packets are legal.
                        log_perror("recv");
                        close_socket();
                        continue;