mirror of
https://github.com/mavlink/mavlink.git
synced 2026-06-19 07:35:34 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user