… | |
… | |
44 | |
44 | |
45 | #include "netcompat.h" |
45 | #include "netcompat.h" |
46 | |
46 | |
47 | #include "vpn.h" |
47 | #include "vpn.h" |
48 | |
48 | |
49 | #define MIN_POLL_INTERVAL .02 // how often to poll minimally when the server has data |
|
|
50 | #define MAX_POLL_INTERVAL 6. // how often to poll minimally when the server has no data |
49 | #define MAX_POLL_INTERVAL 5. // how often to poll minimally when the server has no data |
51 | #define ACTIVITY_INTERVAL 5. |
50 | #define ACTIVITY_INTERVAL 5. |
52 | |
51 | |
53 | #define INITIAL_TIMEOUT 0.1 // retry timeouts |
52 | #define INITIAL_TIMEOUT 0.1 // retry timeouts |
54 | #define INITIAL_SYN_TIMEOUT 10. // retry timeout for initial syn |
53 | #define INITIAL_SYN_TIMEOUT 10. // retry timeout for initial syn |
55 | |
54 | |
56 | #define MIN_SEND_INTERVAL 0.01 // wait at least this time between sending requests |
55 | #define MIN_SEND_INTERVAL 0.001 // wait at least this time between sending requests |
57 | #define MAX_SEND_INTERVAL 2. // optimistic? |
56 | #define MAX_SEND_INTERVAL 2. // optimistic? |
58 | |
57 | |
59 | #define LATENCY_FACTOR 0.5 // RTT * LATENCY_FACTOR == sending rate |
58 | #define LATENCY_FACTOR 0.5 // RTT * LATENCY_FACTOR == sending rate |
60 | #define MAX_OUTSTANDING 100 // max. outstanding requests |
59 | #define MAX_OUTSTANDING 2 // max. outstanding requests |
61 | #define MAX_WINDOW 1000 // max. for MAX_OUTSTANDING, and backlog |
60 | #define MAX_WINDOW 1000 // max. for MAX_OUTSTANDING, and backlog |
62 | #define MAX_BACKLOG (100*1024) // size of gvpe protocol backlog (bytes), must be > MAXSIZE |
61 | #define MAX_BACKLOG (100*1024) // size of gvpe protocol backlog (bytes), must be > MAXSIZE |
63 | |
62 | |
64 | #define MAX_DOMAIN_SIZE 240 // 255 is legal limit, but bind doesn't compress well |
63 | #define MAX_DOMAIN_SIZE 240 // 255 is legal limit, but bind doesn't compress well |
65 | // 240 leaves about 4 bytes of server reply data |
64 | // 240 leaves about 4 bytes of server reply data |
… | |
… | |
424 | u16 max_size; |
423 | u16 max_size; |
425 | u8 seq_cdc; |
424 | u8 seq_cdc; |
426 | u8 req_cdc; |
425 | u8 req_cdc; |
427 | |
426 | |
428 | u8 rep_cdc; |
427 | u8 rep_cdc; |
|
|
428 | u8 delay; // time in 0.01s units that the server may delay replying packets |
429 | u8 r2, r3, r4; |
429 | u8 r3, r4; |
430 | |
430 | |
431 | u8 r5, r6, r7, r8; |
431 | u8 r5, r6, r7, r8; |
432 | |
432 | |
433 | void reset (int clientid); |
433 | void reset (int clientid); |
434 | bool valid (); |
434 | bool valid (); |
… | |
… | |
452 | req_cdc = 62; |
452 | req_cdc = 62; |
453 | rep_cdc = 0; |
453 | rep_cdc = 0; |
454 | max_size = htons (MAX_PKT_SIZE); |
454 | max_size = htons (MAX_PKT_SIZE); |
455 | client = htons (clientid); |
455 | client = htons (clientid); |
456 | uid = next_uid++; |
456 | uid = next_uid++; |
|
|
457 | delay = 0; |
457 | |
458 | |
458 | r2 = r3 = r4 = 0; |
459 | r3 = r4 = 0; |
459 | r4 = r5 = r6 = r7 = 0; |
460 | r4 = r5 = r6 = r7 = 0; |
460 | } |
461 | } |
461 | |
462 | |
462 | bool dns_cfg::valid () |
463 | bool dns_cfg::valid () |
463 | { |
464 | { |
… | |
… | |
729 | established = false; |
730 | established = false; |
730 | |
731 | |
731 | rcvseq = sndseq = 0; |
732 | rcvseq = sndseq = 0; |
732 | |
733 | |
733 | last_sent = last_received = 0; |
734 | last_sent = last_received = 0; |
734 | poll_interval = MIN_POLL_INTERVAL; |
735 | poll_interval = 0.5; // starting here |
735 | send_interval = 0.5; // starting rate |
736 | send_interval = 0.5; // starting rate |
736 | min_latency = INITIAL_TIMEOUT; |
737 | min_latency = INITIAL_TIMEOUT; |
737 | } |
738 | } |
738 | |
739 | |
739 | dns_connection::~dns_connection () |
740 | dns_connection::~dns_connection () |