Skip to content
Browse files

Refactoring

  • Loading branch information...
1 parent fae59d8 commit fd7032800972d6112a1a6dc1e2b7e00d98da6839 @Uriziel Uriziel committed
Showing with 4 additions and 6 deletions.
  1. +4 −6 syncplay/server.py
View
10 syncplay/server.py
@@ -308,9 +308,8 @@ def update_state(self, watcher_proto, counter, ctime, paused, position):
self.pause_change_by = watcher
else:
pause_changed = False
- position, _ = self.find_position(watcher.room)
- self.send_state_to(watcher, position, curtime) # To jest kurwa bez sensu
- self.broadcast_room(watcher, lambda receiver: self.send_state_to(receiver, position, curtime) if pause_changed or (curtime-receiver.last_update_sent) > self.update_time_limit else False)
+ self.send_state_to(watcher) # To jest kurwa bez sensu
+ self.broadcast_room(watcher, lambda receiver: self.send_state_to(receiver, position) if pause_changed or (curtime-receiver.last_update_sent) > self.update_time_limit else False)
def seek(self, watcher_proto, counter, ctime, position):
watcher = self.watchers.get(watcher_proto)
@@ -328,13 +327,12 @@ def __do_seek(self, receiver, position, watcher, curtime):
receiver.max_position = position
receiver.watcher_proto.sender.send_seek(curtime-receiver.time_offset, position, watcher.name)
- def send_state_to(self, watcher, position=None, curtime=None):
+ def send_state_to(self, watcher, position=None):
minWatcher = None
if position is None:
position, minWatcher = self.find_position(watcher.room)
minWatcher = minWatcher.name if minWatcher else None
- if curtime is None:
- curtime = time.time()
+ curtime = time.time()
ctime = curtime - watcher.time_offset
if self.pause_change_by:
watcher.watcher_proto.sender.send_state(watcher.counter, ctime, self.paused[watcher.room], position, self.pause_change_by.name)

0 comments on commit fd70328

Please sign in to comment.
Something went wrong with that request. Please try again.