Commit 6c86994e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make resends less aggressive.

We now limit resends to just 3 copies, both for requests and updates,
since there are enough mechanisms in the protocol to handle packet
loss.
parent 4a86fd9d
...@@ -104,7 +104,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -104,7 +104,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
else if(delay) else if(delay)
resend->delay = delay; resend->delay = delay;
resend->time = now; resend->time = now;
resend->max = kind == RESEND_REQUEST ? 128 : UPDATE_MAX; resend->max = RESEND_MAX;
if(id && memcmp(resend->id, id, 8) == 0 && if(id && memcmp(resend->id, id, 8) == 0 &&
seqno_compare(resend->seqno, seqno) > 0) { seqno_compare(resend->seqno, seqno) > 0) {
return 0; return 0;
...@@ -121,7 +121,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -121,7 +121,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
if(resend == NULL) if(resend == NULL)
return -1; return -1;
resend->kind = kind; resend->kind = kind;
resend->max = kind == RESEND_REQUEST ? 128 : UPDATE_MAX; resend->max = RESEND_MAX;
resend->delay = delay; resend->delay = delay;
memcpy(resend->prefix, prefix, 16); memcpy(resend->prefix, prefix, 16);
resend->plen = plen; resend->plen = plen;
......
...@@ -21,7 +21,7 @@ THE SOFTWARE. ...@@ -21,7 +21,7 @@ THE SOFTWARE.
*/ */
#define REQUEST_TIMEOUT 65000 #define REQUEST_TIMEOUT 65000
#define UPDATE_MAX 4 #define RESEND_MAX 3
#define RESEND_REQUEST 1 #define RESEND_REQUEST 1
#define RESEND_UPDATE 2 #define RESEND_UPDATE 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment