use the proper check to prevent multiple mavlink instances on the same udp port, added warning when different remote than localhost connects to udp

This commit is contained in:
Andreas Antener
2015-12-31 11:50:52 +01:00
parent eff94677a4
commit d39e313768
2 changed files with 13 additions and 6 deletions
+1
View File
@@ -1817,6 +1817,7 @@ MavlinkReceiver::receive_thread(void *arg)
if (srcaddr_last->sin_addr.s_addr == htonl(localhost) && srcaddr.sin_addr.s_addr != htonl(localhost)) {
// if we were sending to localhost before but have a new host then accept him
memcpy(srcaddr_last, &srcaddr, sizeof(srcaddr));
PX4_WARN("UDP source addr changed: %s", inet_ntoa(srcaddr.sin_addr));
}
#endif
/* if read failed, this loop won't execute */