fix: add 5s timeout to TURN credential socket

Hung TURN daemon would block dict proxy handler thread indefinitely.
Per Python docs, settimeout() raises TimeoutError on expiry.
This commit is contained in:
Alex V.
2026-02-07 16:51:19 +03:00
committed by missytake
parent 4d1856d8f1
commit f85d304e65

View File

@@ -4,6 +4,7 @@ import socket
def turn_credentials() -> str:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client_socket:
client_socket.settimeout(5)
client_socket.connect("/run/chatmail-turn/turn.socket")
with client_socket.makefile("rb") as file:
return file.readline().decode("utf-8").strip()