MCPcopy Create free account
hub / github.com/Syncplay/syncplay / handleState

Method handleState

syncplay/protocols.py:746–764  ·  view source on GitHub ↗
(self, state)

Source from the content-addressed store, hash-verified

744
745 @requireLogged
746 def handleState(self, state):
747 position, paused, doSeek, latencyCalculation = None, None, None, None
748 if "ignoringOnTheFly" in state:
749 ignore = state["ignoringOnTheFly"]
750 if "server" in ignore:
751 if self.serverIgnoringOnTheFly == ignore["server"]:
752 self.serverIgnoringOnTheFly = 0
753 if "client" in ignore:
754 self.clientIgnoringOnTheFly = ignore["client"]
755 if "playstate" in state:
756 position, paused, doSeek = self._extractStatePlaystateArguments(state)
757 if "ping" in state:
758 latencyCalculation = state["ping"]["latencyCalculation"] if "latencyCalculation" in state["ping"] else 0
759 clientRtt = state["ping"]["clientRtt"] if "clientRtt" in state["ping"] else 0
760 self._clientLatencyCalculation = state["ping"]["clientLatencyCalculation"] if "clientLatencyCalculation" in state["ping"] else 0
761 self._clientLatencyCalculationArrivalTime = time.time()
762 self._pingService.receiveMessage(latencyCalculation, clientRtt)
763 if self.serverIgnoringOnTheFly == 0:
764 self._watcher.updateState(position, paused, doSeek, self._pingService.getLastForwardDelay())
765
766 def handleError(self, error):
767 self.dropWithError(error["message"]) # TODO: more processing and fallbacking

Callers

nothing calls this directly

Calls 4

receiveMessageMethod · 0.80
updateStateMethod · 0.80
getLastForwardDelayMethod · 0.80

Tested by

no test coverage detected