Subject: Re: [PATCH] Send internal packet priority

Re: [PATCH] Send internal packet priority

From: Daniel Stenberg <>
Date: Wed, 7 Sep 2011 09:20:49 +0200 (CEST)

On Wed, 7 Sep 2011, liuzl wrote:

> I think sftp_read() maybe should not make 4 times of the buffer size.

I think most applications will use small buffers. Counted in kilobytes, and
then the "times four" makes more sense. I think we should at least cap the
read-ahead to a maximum amount. Probably set to the maximum window size we
will set, which current I believe is 3932160 bytes (64K * 60). Possibly even
smaller than so.

I would also not mind if we provide a way for the application to control the
read-ahead amount/behavior somewhat so that it can actually tweak it for its
particular use case.

> 2,caller know the file size, and the incoming buffer size is not bigger than
> the real file size.

In Alexander's case he mentioned the reading of a file that grows over time
(/dev/random style or just a log file growing rapidly). Limiting sftp reading
to a size known before-hand would change our behaviour with such files.

But yes, it would fix the problem with reads beyond the end of file...

Received on 2011-09-07