]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Flushing the buffer when calling IOStream.read_until_close()
authorOmri Bahumi <omrib@everything.me>
Wed, 27 Feb 2013 22:11:32 +0000 (00:11 +0200)
committerOmri Bahumi <omrib@everything.me>
Wed, 27 Feb 2013 22:11:32 +0000 (00:11 +0200)
Ran into this when calling IOStream.read_until_close() after calling
IOStream.read_until("\r\n"), leaving data in the buffer.

tornado/iostream.py

index 86cd68a89c59ad1eff2a88ee27a6c6068b4fef03..9d9fb7156c75a216d6fed50d25a55ef44e3aa7f6 100644 (file)
@@ -174,6 +174,7 @@ class BaseIOStream(object):
             return
         self._read_until_close = True
         self._streaming_callback = stack_context.wrap(streaming_callback)
+        self._read_from_buffer()
         self._add_io_state(self.io_loop.READ)
 
     def write(self, data, callback=None):