C example fixup (#2333)

* udp_example: add missing include

* udp_example: return on error

Otherwise we set src_addr_set even though it's still unknown.
This commit is contained in:
Julian Oes
2025-08-14 16:33:16 +12:00
committed by GitHub
parent e261db27d1
commit f9dbd8c496
+3 -1
View File
@@ -11,6 +11,7 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <time.h>
#include <sys/time.h>
#include <mavlink/common/mavlink.h>
@@ -82,8 +83,9 @@ void receive_some(int socket_fd, struct sockaddr_in* src_addr, socklen_t* src_ad
if (ret < 0) {
printf("recvfrom error: %s\n", strerror(errno));
return;
} else if (ret == 0) {
// peer has done an orderly shutdown
// timeout, try again later
return;
}