mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-22 17:00:41 -05:00
Rework of tcponudp/tcpstream should make UDP connections much more stable.
- Fixed retransmit algorithm. Much more closely matched to TCP standard: http://tools.ietf.org/html/rfc2988 - This increases retransmit timeouts, and reduces the number of packets resent. - Added better debugging for retrans/close as separate #defines. - Further testing is required ;) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5252 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6e536ae67e
commit
bc7b42d81f
2 changed files with 430 additions and 192 deletions
|
|
@ -49,6 +49,7 @@
|
|||
#define TCP_MAX_WIN 65500
|
||||
#define TCP_ALIVE_TIMEOUT 15 /* 15 sec ... < 20 sec UDP state limit on some firewalls */
|
||||
#define TCP_RETRANS_TIMEOUT 1 /* 1 sec (Initial value) */
|
||||
#define TCP_RETRANS_MAX_TIMEOUT 15 /* 15 secs */
|
||||
#define kNoPktTimeout 60 /* 1 min */
|
||||
|
||||
|
||||
|
|
@ -117,6 +118,9 @@ bool ridle(); /* read idle */
|
|||
uint32 wbytes();
|
||||
uint32 rbytes();
|
||||
|
||||
/* Exposed for debugging */
|
||||
int dumpstate(std::ostream &out);
|
||||
|
||||
private:
|
||||
|
||||
/* Internal Functions - use the Mutex (not reentrant) */
|
||||
|
|
@ -129,6 +133,9 @@ bool isOldSequence(uint32 tst, uint32 curr);
|
|||
|
||||
/* Internal Functions - only called inside mutex protection */
|
||||
|
||||
int dumpstate_locked(std::ostream &out);
|
||||
int status_locked(std::ostream &out);
|
||||
|
||||
int cleanup();
|
||||
|
||||
/* incoming data */
|
||||
|
|
@ -159,6 +166,14 @@ void setRemoteAddress(const struct sockaddr_in &raddr);
|
|||
int getTTL() { return ttl; }
|
||||
void setTTL(int t) { ttl = t; }
|
||||
|
||||
/* retransmission */
|
||||
void startRetransmitTimer();
|
||||
void restartRetransmitTimer();
|
||||
void stopRetransmitTimer();
|
||||
void resetRetransmitTimer();
|
||||
void incRetransmitTimeout();
|
||||
|
||||
|
||||
/* data counting */
|
||||
uint32 int_wbytes();
|
||||
uint32 int_rbytes();
|
||||
|
|
@ -195,12 +210,15 @@ uint32 int_rbytes();
|
|||
|
||||
uint32 inAckno; /* next expected */
|
||||
uint32 inWinSize; /* allowing other to send */
|
||||
uint32 rrt;
|
||||
|
||||
/* some (initially) consts */
|
||||
uint32 maxWinSize;
|
||||
uint32 keepAliveTimeout;
|
||||
|
||||
/* retransmit */
|
||||
bool retransTimerOn;
|
||||
double retransTimeout;
|
||||
double retransTimerTs;
|
||||
|
||||
/* some timers */
|
||||
double keepAliveTimer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue