Skip to content

Commit

Permalink
core: fix TCP server for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Jul 17, 2024
1 parent 0a24376 commit b74706e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/mavsdk/core/tcp_server_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,23 @@ void TcpServerConnection::receive()
return;
}
}
#else
if (recv_len < 0) {
// On macOS we presumably see the same thing, and have to try again.
if (errno == EAGAIN) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
continue;
}

LogErr() << "recv failed: " << GET_ERROR(errno);
return;
}
#endif

if (recv_len == 0) {
continue;
}

if (recv_len < 0) {
LogErr() << "recv failed: " << GET_ERROR(errno);
return;
}

_mavlink_receiver->set_new_datagram(buffer.data(), static_cast<int>(recv_len));

// Parse all mavlink messages in one data packet. Once exhausted, we'll exit while.
Expand Down

0 comments on commit b74706e

Please sign in to comment.