MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / stop

Method stop

apps/proxy/live_proxy/input/buffer.py:290–323  ·  view source on GitHub ↗

Stop the buffer and cancel all timers

(self)

Source from the content-addressed store, hash-verified

288 return []
289
290 def stop(self):
291 """Stop the buffer and cancel all timers"""
292 # Set stopping flag first to prevent new timer creation
293 self.stopping = True
294
295 # Cancel all pending timers
296 timers_cancelled = 0
297 for timer in list(self.fill_timers):
298 try:
299 if timer and not timer.dead: # Changed from timer.is_alive()
300 timer.kill() # Changed from timer.cancel()
301 timers_cancelled += 1
302 except Exception as e:
303 logger.error(f"Error canceling timer: {e}")
304
305 if timers_cancelled:
306 logger.info(f"Cancelled {timers_cancelled} buffer timers for channel {self.channel_id}")
307
308 # Clear timer list
309 self.fill_timers.clear()
310
311 try:
312 with self.lock:
313 if hasattr(self, '_write_buffer') and len(self._write_buffer) > 0:
314 discarded = len(self._write_buffer)
315 self._write_buffer = bytearray()
316 if hasattr(self, '_partial_packet'):
317 self._partial_packet = bytearray()
318 logger.debug(
319 f"Discarded {discarded} bytes from local write buffer "
320 f"for channel {self.channel_id}"
321 )
322 except Exception as e:
323 logger.error(f"Error during buffer stop: {e}")
324
325 def get_optimized_client_data(self, client_index):
326 """Get optimal amount of data for client streaming based on position and target size"""

Calls 1

killMethod · 0.45