Skip to content

Commit

Permalink
RequestHandler sets its close callback on the HTTPConnection, not the…
Browse files Browse the repository at this point in the history
… IOStream.

Fixes a bug in which close callbacks would never be called for subsequent
requests on a reused connection.
  • Loading branch information
bdarnell committed Aug 4, 2013
1 parent f2e2367 commit 38f9007
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tornado/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,10 @@ def finish(self, chunk=None):

if hasattr(self.request, "connection"):
# Now that the request is finished, clear the callback we
# set on the IOStream (which would otherwise prevent the
# set on the HTTPConnection (which would otherwise prevent the
# garbage collection of the RequestHandler when there
# are keepalive connections)
self.request.connection.stream.set_close_callback(None)
self.request.connection.set_close_callback(None)

if not self.application._wsgi:
self.flush(include_footers=True)
Expand Down

0 comments on commit 38f9007

Please sign in to comment.