Skip to content

Commit

Permalink
MAVLink: Improve network handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzMeier committed Feb 9, 2016
1 parent fb8b981 commit 3e02bb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/modules/mavlink/mavlink_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,12 +1052,9 @@ Mavlink::init_udp()

/* set default target address, but not for onboard mode (will be set on first received packet) */
memset((char *)&_src_addr, 0, sizeof(_src_addr));
if (_mode != MAVLINK_MODE_ONBOARD) {
_src_addr.sin_family = AF_INET;
inet_aton("127.0.0.1", &_src_addr.sin_addr);
_src_addr.sin_port = htons(_remote_port);
set_client_source_initialized();
}
_src_addr.sin_family = AF_INET;
inet_aton("127.0.0.1", &_src_addr.sin_addr);
_src_addr.sin_port = htons(_remote_port);

/* default broadcast address */
memset((char *)&_bcast_addr, 0, sizeof(_bcast_addr));
Expand Down
1 change: 1 addition & 0 deletions src/modules/mavlink/mavlink_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,7 @@ MavlinkReceiver::receive_thread(void *arg)
srcaddr_last->sin_addr.s_addr = srcaddr.sin_addr.s_addr;
srcaddr_last->sin_port = srcaddr.sin_port;
_mavlink->set_client_source_initialized();
warnx("changing partner IP to: %s", inet_ntoa(srcaddr.sin_addr));
}
}
#endif
Expand Down

0 comments on commit 3e02bb1

Please sign in to comment.