Skip to content

Commit

Permalink
Merge pull request #1187 from mavlink/fix-send-message
Browse files Browse the repository at this point in the history
Fix regression in UDP `send_message`
  • Loading branch information
julianoes authored Sep 10, 2020
2 parents 4669ffd + 18aeac6 commit f2ff514
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/core/udp_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,13 @@ bool UdpConnection::send_message(const mavlink_message_t& message)
return false;
}

// Some messages have a target system set which allows to send it only
// on the matching link.
const mavlink_msg_entry_t* entry = mavlink_get_msg_entry(message.msgid);
const uint8_t target_system_id =
(entry && (entry->flags & MAV_MSG_ENTRY_FLAG_HAVE_TARGET_SYSTEM) ?
reinterpret_cast<const uint8_t*>(message.payload64)[entry->target_system_ofs] :
0);

// Send the message to all the remotes. A remote is a UDP endpoint
// identified by its <ip, port>. This means that if we have two
// systems on two different endpoints, then messages directed towards
// only one system will be sent to both remotes. The systems are
// then expected to ignore messages that are not directed to them.
bool send_successful = true;
for (auto& remote : _remotes) {
if (target_system_id != 0) {
continue;
}

struct sockaddr_in dest_addr {};
dest_addr.sin_family = AF_INET;

Expand Down

0 comments on commit f2ff514

Please sign in to comment.