MCPcopy Index your code
hub / github.com/Syncplay/syncplay / handleState

Method handleState

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

Source from the content-addressed store, hash-verified

270 return messageAge, latencyCalculation
271
272 def handleState(self, state):
273 position, paused, doSeek, setBy = None, None, None, None
274 messageAge = 0
275 if not self.hadFirstStateUpdate:
276 self.hadFirstStateUpdate = True
277 if "ignoringOnTheFly" in state:
278 ignore = state["ignoringOnTheFly"]
279 if "server" in ignore:
280 self.serverIgnoringOnTheFly = ignore["server"]
281 self.clientIgnoringOnTheFly = 0
282 elif "client" in ignore:
283 if(ignore['client']) == self.clientIgnoringOnTheFly:
284 self.clientIgnoringOnTheFly = 0
285 if "playstate" in state:
286 position, paused, doSeek, setBy = self._extractStatePlaystateArguments(state)
287 if "ping" in state:
288 messageAge, latencyCalculation = self._handleStatePing(state)
289 if position is not None and paused is not None and not self.clientIgnoringOnTheFly:
290 self._client.updateGlobalState(position, paused, doSeek, setBy, messageAge)
291 position, paused, doSeek, stateChange = self._client.getLocalState()
292 self.sendState(position, paused, doSeek, latencyCalculation, stateChange)
293
294 def sendState(self, position, paused, doSeek, latencyCalculation, stateChange=False):
295 state = {}

Callers 1

handleMessagesMethod · 0.45

Calls 5

_handleStatePingMethod · 0.95
sendStateMethod · 0.95
updateGlobalStateMethod · 0.80
getLocalStateMethod · 0.80

Tested by

no test coverage detected