Skip to content

Commit

Permalink
Add wfb_tx_cmd call timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Aug 8, 2024
1 parent f16afcc commit 3a9bdad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tx_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <time.h>
#include "tx_cmd.h"

#define COMMAND_TIMEOUT 3 //[seconds]

int send_command(int port, cmd_req_t req, size_t req_size)
{
Expand All @@ -47,6 +48,8 @@ int send_command(int port, cmd_req_t req, size_t req_size)
addr.sin_port = htons(port);
inet_pton(addr.sin_family, "127.0.0.1", &addr.sin_addr);

alarm(COMMAND_TIMEOUT);

rc = sendto(fd, &req, req_size, 0, (struct sockaddr *)&addr, sizeof(addr));
if (rc < 0)
{
Expand Down

0 comments on commit 3a9bdad

Please sign in to comment.