summary refs log tree commit diff
path: root/synapse/events/__init__.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-06-01 10:56:05 +0100
committerMark Haines <mark.haines@matrix.org>2015-06-01 10:56:05 +0100
commitb8d49be5a1d8719ec47a44547d043874c8bfaddc (patch)
tree52e58244f968f10176f8624eac19452d3337f810 /synapse/events/__init__.py
parentUse Twisted-15.2.1, Use Agent.usingEndpointFactory rather than implement our ... (diff)
parentMerge pull request #172 from intelfx/contrib-systemd (diff)
downloadsynapse-b8d49be5a1d8719ec47a44547d043874c8bfaddc.tar.xz
Merge branch 'develop' into markjh/twisted-15
Conflicts:
	synapse/python_dependencies.py
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r--synapse/events/__init__.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index e4495ccf12..39ce4f7c42 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -16,6 +16,12 @@
 from synapse.util.frozenutils import freeze
 
 
+# Whether we should use frozen_dict in FrozenEvent. Using frozen_dicts prevents
+# bugs where we accidentally share e.g. signature dicts. However, converting
+# a dict to frozen_dicts is expensive.
+USE_FROZEN_DICTS = True
+
+
 class _EventInternalMetadata(object):
     def __init__(self, internal_metadata_dict):
         self.__dict__ = dict(internal_metadata_dict)
@@ -122,7 +128,10 @@ class FrozenEvent(EventBase):
 
         unsigned = dict(event_dict.pop("unsigned", {}))
 
-        frozen_dict = freeze(event_dict)
+        if USE_FROZEN_DICTS:
+            frozen_dict = freeze(event_dict)
+        else:
+            frozen_dict = event_dict
 
         super(FrozenEvent, self).__init__(
             frozen_dict,