Bugfixes for TcoOnUdp:

* Reduce Maximum Transmission size from 1500 -> 1000.  
	This is the cause of Failed Connections. It looks like UDP packets are being truncated from 1520 -> 1492 bytes.
	and this is killing the TCP protocol. Windows is the main suspect. UDP packets this large are liable to get fragmented anyway.
	We will start at 1000, verify that connections are okay, then start increasing this parameter.
	There is up to 64 bytes of Headers (IP + UDP + Relay + TOU), so 1400 + 64 = 1464 is below the 1492 cutoff. This is the target!
 * Switch to RSRandom for Sequence numbers. rand() is rubbish on Windows.
 * Added code to handle Larger Packets coming in (e.g. 1500 Bytes input, now that Max Size is 1000).

NB: The code is here needs to be optimised, there are excessive numbers of malloc(), new() & memcpy(), which should be removed.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4482 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-20 18:37:21 +00:00
parent a683b64311
commit d0f52f1d5f
2 changed files with 107 additions and 20 deletions

View file

@ -38,7 +38,13 @@
#include "tcppacket.h"
#include "udppeer.h"
#define MAX_SEG 1500
// WINDOWS doesn't like UDP packets bigger than 1492 (truncates them).
// We have up to 64 bytes of headers: 28(udp) + 16(relay) + 20(tou) = 64 bytes.
// 64 bytes + 1400 = 1464, leaves a small margin, but close to maximum throughput.
//#define MAX_SEG 1400
// We are going to start at 1000 (to avoid any fragmentation, and work up).
#define MAX_SEG 1000
#define TCP_MAX_SEQ UINT_MAX
#define TCP_MAX_WIN 65500
#define TCP_ALIVE_TIMEOUT 15 /* 15 sec ... < 20 sec UDP state limit on some firewalls */