From: Ben Darnell Date: Sun, 7 Jul 2013 17:38:08 +0000 (-0400) Subject: Clear the write buffer when an IOStream is closed. X-Git-Tag: v3.2.0b1~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c43996288e52a8f68728164f9284cf286d38543a;p=thirdparty%2Ftornado.git Clear the write buffer when an IOStream is closed. Closes #828. --- diff --git a/tornado/iostream.py b/tornado/iostream.py index 550e68da9..6a507a81d 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -274,6 +274,10 @@ class BaseIOStream(object): self._run_callback(cb) # Delete any unfinished callbacks to break up reference cycles. self._read_callback = self._write_callback = None + # Clear the buffers so they can be cleared immediately even + # if the IOStream object is kept alive by a reference cycle. + # TODO: Clear the read buffer too; it currently breaks some tests. + self._write_buffer = None def reading(self): """Returns true if we are currently reading from the stream."""