summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Lihotzki <lukas@lihotzki.de>2021-09-30 14:04:55 +0200
committerGitHub <noreply@github.com>2021-09-30 08:04:55 -0400
commit145cb6d08e2f775da208293a507c1dcd2d4128ce (patch)
tree883c4e16a5c91bd3b2d0789c46bd04b58cd38536
parentPass str to twisted's IReactorTCP (#10895) (diff)
downloadsynapse-145cb6d08e2f775da208293a507c1dcd2d4128ce.tar.xz
Fix getTurnServer response: return an integer ttl (#10922)
`ttl` must be an integer according to the OpenAPI spec:
https://github.com/matrix-org/matrix-doc/blob/old_master/data/api/client-server/voip.yaml#L70

True division (`/`) returns a float instead (`"ttl": 7200.0`).
Floor division (`//`) returns an integer, so the response is spec compliant.

Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
-rw-r--r--changelog.d/10922.bugfix1
-rw-r--r--synapse/rest/client/voip.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/changelog.d/10922.bugfix b/changelog.d/10922.bugfix
new file mode 100644
index 0000000000..b7315514e0
--- /dev/null
+++ b/changelog.d/10922.bugfix
@@ -0,0 +1 @@
+Fix a minor bug in the response to `/_matrix/client/r0/voip/turnServer`. Contributed by @lukaslihotzki.
diff --git a/synapse/rest/client/voip.py b/synapse/rest/client/voip.py
index ea2b8aa45f..ea7e025156 100644
--- a/synapse/rest/client/voip.py
+++ b/synapse/rest/client/voip.py
@@ -70,7 +70,7 @@ class VoipRestServlet(RestServlet):
             {
                 "username": username,
                 "password": password,
-                "ttl": userLifetime / 1000,
+                "ttl": userLifetime // 1000,
                 "uris": turnUris,
             },
         )