Author giampaolo.rodola
Recipients christian.heimes, giampaolo.rodola, neologix, pitrou
Date 2013-03-26.21:05:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364331931.77.0.915967488663.issue17552@psf.upfronthosting.co.za>
In-reply-to
Content
> I don't understand the point of the second member in the tuple

The 'exception' member can be useful to know the reason why sendfile() failed and send() was used as fallback.


> the timeout logic should be fixed so that the total operation
> time doesn't exceed the timeout, rather than each iteration

Do you mean that if the user sets a timeout=2 and the whole transfer takes longer than that you expect a timeout exception?
That's pretty unusual (e.g. ftplib does not behave like that).


> non-blocking sockets could be supported by returning partial writes,
> and letting the caller pass an offset argument

I see little value in supporting non-blocking sockets because someone willing to do that usually wants to use sendfile() directly (no wrappers involved) as they are forced to handle errors and take count of transmitted bytes in their own code anyway.
Here's an example of how sendfile is supposed to be used with non-blocking sockets:
https://code.google.com/p/pyftpdlib/source/browse/tags/release-0.7.0/pyftpdlib/ftpserver.py#1035
An extra layer such as the one proposed in my patch is completely useless and also slow considering the amount of instructions before the actual sendfile() call.
It is however a good idea to provide an 'offset' argument.


> as a vocabulary nit, I don't really understand what "mmap-like file" means

Will turn that into "regular files".


> I don't see how you could get EMFILE (select() will return a ValueError)

Right. Will fix that.

> is there any platform with sendfile() which doesn't support poll()?

No idea. I made a quick tour on snakebite and apparently all of the provided platforms have poll(). 


> I still don't see the point of calling sendfile() with a block size

I will make some actual benchmarks and fix that later if makes sense.
Assuming providing a high blocksize (say 1MB) makes no difference in terms of CPU usage it's better to keep that for consistency with sendall() in case we fallback on using it.
History
Date User Action Args
2013-03-26 21:05:31giampaolo.rodolasetrecipients: + giampaolo.rodola, pitrou, christian.heimes, neologix
2013-03-26 21:05:31giampaolo.rodolasetmessageid: <1364331931.77.0.915967488663.issue17552@psf.upfronthosting.co.za>
2013-03-26 21:05:31giampaolo.rodolalinkissue17552 messages
2013-03-26 21:05:31giampaolo.rodolacreate