On 17 February 2014 17:33, Guido van Rossum <[email protected]> wrote:

> The right idiom to do this (without referencing the reader) is to set the
> write buffer size to zero and then call drain(). However I think there's a
> bug -- if in a non-paused state you use set_write_buffer_size() to set the
> buffer high-water mark below the current buffer content's size, the
> transport should enter pause state but it doesn't.
>

Filed as https://code.google.com/p/tulip/issues/detail?id=140


>
> So perhaps your wait-for-eof-on-reader strategy is better, unless we
> manage to fix the above thing.
>
> An ideal API might be built on top of all these.
>

-> https://code.google.com/p/tulip/issues/detail?id=141

Thanks.


> Please file bugs to track these issues.
>
>
> On Mon, Feb 17, 2014 at 8:28 AM, Gustavo Carneiro <[email protected]>wrote:
>
>> In tulip, if I have a tcp  connection to a server
>> (asyncio.streams.open_connection), it is not trivial to ensure that all
>> data was written before closing the application.
>>
>> If I simply call close() on either the StreamWriter or Transport, it
>> basically does nothing.  Data will continue to be written in the
>> background, which means that if I exit from the Python script immediately I
>> risk not having all data written to the socket.
>>
>> From what I can tell, I have to close() the StreamWriter, then read from
>> the StreamReader until I get an empty string (EOF).  Am I understanding
>> this correctly?
>>
>> I wish this sort of thing were a bit more intuitive in a future revision
>> of tulip.  A synchronous close() would be helpful, I think.
>>
>> --
>> Gustavo J. A. M. Carneiro
>> Gambit Research LLC
>> "The universe is always one step beyond logic." -- Frank Herbert
>>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>



-- 
Gustavo J. A. M. Carneiro
Gambit Research LLC
"The universe is always one step beyond logic." -- Frank Herbert

Reply via email to