Fully enable gc in http_test.py and fix resulting errors.
Change-Id: I66ca7d7fd435d7472f01b65e0c9b53d733987a87
diff --git a/tornado/httpserver.py b/tornado/httpserver.py
index bbe4a21..b71bf70 100644
--- a/tornado/httpserver.py
+++ b/tornado/httpserver.py
@@ -168,9 +168,10 @@
# Save stack context here, outside of any request. This keeps
# contexts from one request from leaking into the next.
self._header_callback = stack_context.wrap(self._on_headers)
- self.stream.read_until(b("\r\n\r\n"), self._header_callback)
self._write_callback = None
self._close_callback = None
+ self.set_close_callback(lambda: None)
+ self.stream.read_until(b("\r\n\r\n"), self._header_callback)
def set_close_callback(self, callback):
self._close_callback = stack_context.wrap(callback)
diff --git a/tornado/iostream.py b/tornado/iostream.py
index 7ce75db..89abeaf 100644
--- a/tornado/iostream.py
+++ b/tornado/iostream.py
@@ -390,6 +390,7 @@
self._check_closed()
finally:
self._pending_callbacks -= 1
+ self._maybe_add_error_listener()
if self._read_from_buffer():
return
self._add_io_state(self.io_loop.READ)