Subject: Re: very slow TCP connection on localhost
To: Bill Studenmund <wrstuden@netbsd.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-net
Date: 09/08/2006 06:31:53
On Sep 7, 2006, at 12:43 PM, Bill Studenmund wrote:

> On Thu, Sep 07, 2006 at 09:30:05AM -0400, Greg Troxel wrote:
>>
>> So I see several problems:
>>
>> * receiver window is way too small.  This could be because recvspace
>>   is small, or because the reader doesn't take data out until there's
>>   enough, and 'enough' is large relative to recvspace.
>
> There is another issue in this area I've seen. There is no way for the
> socket layer to tell the tcp layer that it has taken data out of the
> buffer. So if we get into strange traffic patterns like this, we  
> can end
> up with a closed or limited window on the sender side even though the
> window (on the receiver side) is open. Well the crux is that it'd  
> be open
> if the receive side checked it out.

That's what PRU_RCVD does, it tells the protocol data has been read  
out of
the socket buffers.  And TCP has PR_WANTRCVD set so it gets PRU_RCVD.

#define PRU_RCVD                8       /* have taken data; more room  
now */