Skip to content

Commit

Permalink
[?] Fix error handling logic for heartbeat operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Nov 3, 2024
1 parent b95859e commit 1717e47
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions server/main_server/src/agent_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,15 @@ namespace

while (bytes_to_send) {
const int bytes_sent = send(net_obj->socket_handle(), &(heartbeat[heartbeat_length - bytes_to_send]), bytes_to_send, 0);
const int errsav = errno;
if (errsav != EINTR) {
log_agent::error("{}: Socket error encountered during heartbeat; socket returned {}",
__func__, strerror(errsav));
break;
if (bytes_sent == -1) {
const int errsav = errno;
if (errsav != EINTR) {
log_agent::error("{}: Socket error encountered during heartbeat; socket returned {}",
__func__, strerror(errsav));
break;
}
}

if (bytes_sent > 0) {
else if (bytes_sent > 0) {
bytes_to_send -= bytes_sent;
}
}
Expand Down

0 comments on commit 1717e47

Please sign in to comment.