From 3f86c8bb935408fdfb056a412da23b6b181d0755 Mon Sep 17 00:00:00 2001 From: GDR! Date: Sat, 13 Dec 2014 19:13:12 +0100 Subject: [PATCH] Increased number of send retries - helpful on flaky links --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 45f415a..10a7ba6 100644 --- a/main.c +++ b/main.c @@ -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; @@ -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, @@ -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;