summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-06-27 16:25:38 +0100
committerErik Johnston <erik@matrix.org>2017-06-27 16:25:38 +0100
commit27f26e48b7740248dd4d45b7bb2487b38477b7f4 (patch)
treeabb4f0b0de761da4e705faf45a11c6d793d226b9
parentFix up (diff)
downloadsynapse-27f26e48b7740248dd4d45b7bb2487b38477b7f4.tar.xz
Serialize user ip command as json
Diffstat (limited to '')
-rw-r--r--synapse/replication/tcp/commands.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/replication/tcp/commands.py b/synapse/replication/tcp/commands.py
index a009214e43..171227cce2 100644
--- a/synapse/replication/tcp/commands.py
+++ b/synapse/replication/tcp/commands.py
@@ -323,14 +323,18 @@ class UserIpCommand(Command):
 
     @classmethod
     def from_line(cls, line):
-        user_id, access_token, ip, device_id, last_seen, user_agent = line.split(" ", 5)
+        user_id, jsn = line.split(" ", 1)
 
-        return cls(user_id, access_token, ip, user_agent, device_id, int(last_seen))
+        access_token, ip, user_agent, device_id, last_seen = json.loads(jsn)
+
+        return cls(
+            user_id, access_token, ip, user_agent, device_id, last_seen
+        )
 
     def to_line(self):
-        return " ".join((
-            self.user_id, self.access_token, self.ip, self.device_id,
-            str(self.last_seen), self.user_agent,
+        return self.user_id + " " + json.dumps((
+            self.access_token, self.ip, self.user_agent, self.device_id,
+            self.last_seen,
         ))