Brian Vandenberg <phant...@gmail.com> added the comment:

Christian, you did exactly what I needed.  Thank you.

I don't have the means to do a git bisect to find where it broke.  It wasn't a 
problem around 3.3 timeframe and I'm not sure when this sendfile stuff was 
implemented.

The man page for sendfile says "The sendfile() function does not modify the 
current file pointer of in_fd, (...)".  In other words the read pointer for the 
input descriptor won't be advanced.  They expect you to use it like this:

offset = 0;
do {
  ret = sendfile(in, out, &offset, len);
} while( ret < 0 && (errno == EAGAIN || errno == EINTR) );

... though making that change in posixmodule.c would break this test severely 
since the send & receive code is running on the same thread.

In posixmodule.c I don't see anything that attempts to return the number of 
bytes successfully sent.  Since the input file descriptor won't have its read 
pointer advanced, the variable "offset" must be set to the correct offset 
value, otherwise it just keeps reading the first 32k of the file that was 
generated for the test.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue29269>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to