Skip to content

Commit

Permalink
Increased number of send retries - helpful on flaky links
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedeer committed Dec 13, 2014
1 parent 489cad2 commit 3f86c8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ int get_client_socket(char *hostname, int port)
int send_frame(protocol_frame *frame, uint8_t *data)
{
int rv = -1;
int try = 0;
int i;

data[0] = PROTOCOL_MAGIC_HIGH;
Expand All @@ -234,10 +235,12 @@ int send_frame(protocol_frame *frame, uint8_t *data)
data[6] = BYTE2(frame->data_length);
data[7] = BYTE1(frame->data_length);

for(i = 0; i < 17;)
for(i = 0; i < 65;) /* 1.27 seconds per packet max */
{
int j;

try++;

rv = tox_send_lossless_packet(
tox,
frame->friendnumber,
Expand Down Expand Up @@ -267,7 +270,7 @@ int send_frame(protocol_frame *frame, uint8_t *data)

if(i > 0 && rv >= 0)
{
fprintf(stderr, "Packet succeeded at try %d\n", i+1);
fprintf(stderr, "Packet succeeded at try %d\n", try);
}

return rv;
Expand Down

0 comments on commit 3f86c8b

Please sign in to comment.