Fix exceptions when a connection is closed before we read the headers

This fixes bugs introduced in #3700, by making sure that we behave sanely
when an incoming connection is closed before the headers are read.
This commit is contained in:
Richard van der Hoff 2018-08-20 18:21:10 +01:00
parent 55e6bdf287
commit be6527325a
2 changed files with 10 additions and 2 deletions

View file

@ -402,7 +402,9 @@ class PreserveLoggingContext(object):
__slots__ = ["current_context", "new_context", "has_parent"]
def __init__(self, new_context=LoggingContext.sentinel):
def __init__(self, new_context=None):
if new_context is None:
new_context = LoggingContext.sentinel
self.new_context = new_context
def __enter__(self):