On Fri, Jan 25, 2013 at 10:03 AM, Nikolay Kim <span dir="ltr"><<a href="mailto:fafhrd91@gmail.com" target="_blank">fafhrd91@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
I think Transport needs 'sendfile' api, something like:<br>
<br>
   @tasks.coroutine<br>
   def sendfile(self, fd, offset, nbytes):<br>
      ….<br>
<br>
otherwise it is impossible to implement sendfile without breaking transport encapsulation</blockquote><div> </div></div>Really? Can't the user write this themselves? What's wrong with this:<br><br>while True:<br>

  data = os.read(fd, 16*1024)<br>  if not data: break<br>  transport.write(data)<br><br>(Perhaps augmented with a way to respond to pause() requests.)<br clear="all"><br>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)