diff --git a/src/client.c b/src/client.c index fcda275..29b2bb1 100644 --- a/src/client.c +++ b/src/client.c @@ -209,7 +209,7 @@ update_server_timeout(int handshake) } /* update up/down window timeouts to something reasonable */ - this.downstream_timeout_ms = rtt_ms * this.downstream_delay_variance / 100; + this.downstream_timeout_ms = rtt_ms * this.downstream_delay_variance; this.outbuf->timeout = ms_to_timeval(this.downstream_timeout_ms); if (handshake) { diff --git a/src/client.h b/src/client.h index 2aea61b..6d1f013 100644 --- a/src/client.h +++ b/src/client.h @@ -88,7 +88,7 @@ struct client_instance { /* Server response timeout in ms and downstream window timeout */ time_t server_timeout_ms; time_t downstream_timeout_ms; - time_t downstream_delay_variance; + double downstream_delay_variance; int autodetect_server_timeout; /* Cumulative Round-Trip-Time in ms */ diff --git a/src/iodine.c b/src/iodine.c index 646a0ed..ab389d9 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -82,7 +82,7 @@ struct client_instance this; .next_downstream_ack = -1, \ .num_immediate = 1, \ .rtt_total_ms = 200, \ - .downstream_delay_variance = 200, \ + .downstream_delay_variance = 2.0, \ .remote_forward_addr = {.ss_family = AF_UNSPEC} static struct client_instance preset_default = { @@ -576,7 +576,7 @@ main(int argc, char **argv) } break; case 'J': - this.downstream_delay_variance = strtod(optarg, NULL) * 100; + this.downstream_delay_variance = strtod(optarg, NULL); break; case 's': this.send_interval_ms = atoi(optarg); @@ -696,7 +696,7 @@ main(int argc, char **argv) usage(); } - if (this.downstream_delay_variance < 10) { + if (this.downstream_delay_variance < 0.1) { warnx("Delay variance factor must be more than 0.1 to prevent excessive retransmits."); usage(); }