summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-08-20 18:21:10 +0100
committerRichard van der Hoff <richard@matrix.org>2018-08-20 18:21:10 +0100
commitbe6527325a829e7d5e4540d7a1983a6e6fda2c0f (patch)
tree5a0e45b4a35a07978b21d95c0cb740c66b81992f /synapse/util
parentRobustness fix for logcontext filter (diff)
downloadsynapse-be6527325a829e7d5e4540d7a1983a6e6fda2c0f.tar.xz
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.
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/logcontext.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py
index 848765e530..a0c2d37610 100644
--- a/synapse/util/logcontext.py
+++ b/synapse/util/logcontext.py
@@ -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):