[PATCH] Maintain outgoing TCP meta buffer

Guus Sliepen guus at tinc-vpn.org
Sat Jan 14 20:39:16 CET 2006


On Sat, Jan 14, 2006 at 10:36:15AM -0800, Scott Lamb wrote:

> >Adding a buffer and testing for writablity will certainly prevent the
> >problems that make BlockingTCP necessary. But, how large do we  
> >allow the
> >buffers to grow? What do we do when it reaches a limit?
> 
> You're right: a limit definitely needs to be set. I've got enough  
> memory to throw at things, but I just tried simulating the worst  
> case: I took my Ethernet interface down and ran "ping -fs 65507  
> 172.16.0.2". I thought it would realize the connection went down  
> before growing to be unreasonably large, but apparently not. In the  
> two and a half minutes before it pulled the plug, the buffer grew to  
> 284 megs.
> 
> I'm tempted to address this by time rather than buffer size. Maybe if  
> it's had unflushed data for five seconds (which would be  
> configurable), it will terminate the connection as your code did  
> before. This would limit the buffer growth, and it'd make tinc notice  
> problems even if you stop filling the buffer.

Another option is to do nothing in send_tcppacket() if there is more
than a certain number of bytes left in the buffer. Actually, on Linux
you can see the amount of data left in the kernel's TCP buffers with
ioctl(fd, SIOCOUTQ, &amount), but that is not portable and does not give
any guarantees about write() not returing EWOULDBLOCK.

-- 
Met vriendelijke groet / with kind regards,
    Guus Sliepen <guus at sliepen.eu.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://brouwer.uvt.nl/pipermail/tinc-devel/attachments/20060114/eaa26139/attachment.pgp


More information about the tinc-devel mailing list