From 9b90dd50a7b3a8fccc81b61f2586aea5bb9b4c81 Mon Sep 17 00:00:00 2001 From: et0h Date: Fri, 19 Feb 2021 14:56:15 +0000 Subject: [PATCH] Attempt to fix VLC connection issues --- syncplay/players/vlc.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 39cd1df..3838d66 100755 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -50,6 +50,24 @@ class VLCProtocol(LineReceiver): self.factory.connected = False class VLCClientFactory(ReconnectingClientFactory): + + # http://twistedmatrix.com/documents/current/api/twisted.internet.protocol.ReconnectingClientFactory.html + # + initialDelay = 0.3 + maxDelay = 0.45 + maxRetries = 50 + + def startedConnecting(self, connector): + self._playerController._client.ui.showDebugMessage("Starting to connect to VLC...") + + def clientConnectionLost(self, connector, reason): + self._playerController._client.ui.showDebugMessage("Connection to VLC lost: {}".format(reason)) + ReconnectingClientFactory.clientConnectionLost(self, connector, reason) + + def clientConnectionFailed(self, connector, reason): + self._playerController._client.ui.showDebugMessage("Connection to VLC failed: {}".format(reason)) + ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) + def __init__(self, playerController, vlcHasResponded, vlcLaunchedTime, vlcProcess): self._playerController = playerController self._process = vlcProcess