stall watchdog: no fake last-byte on reattach; cap swapping at stall timeout (measured 40-57s freeze @vimtoo.2)
Browse files
relay.py
CHANGED
|
@@ -576,6 +576,7 @@ class Sender:
|
|
| 576 |
return None
|
| 577 |
sess['swapping'] = True
|
| 578 |
sess['swap_source'] = True
|
|
|
|
| 579 |
try:
|
| 580 |
if response:
|
| 581 |
try:
|
|
@@ -606,7 +607,8 @@ class Sender:
|
|
| 606 |
sess['stall_reason'] = ''
|
| 607 |
sess['force_stop'] = False
|
| 608 |
sess['timeouts'] = 0
|
| 609 |
-
sess['last']
|
|
|
|
| 610 |
sess['reattaches'] = int(sess.get('reattaches') or 0) + 1
|
| 611 |
self.current_candidate = cand
|
| 612 |
self.set(source=cand.get('label') or cand.get('brief') or '', stalled=False)
|
|
@@ -809,7 +811,10 @@ class Sender:
|
|
| 809 |
# ุญููุง ูููุชููุจ ูุจูู ุนูู ุขุฎุฑ ุซุงููุฉ โ ููุฐุง ูู ุงูุชุนููู ุงูุฐู ุดูุง ู
ูู ุงูู
ุณุชุฎุฏู
.
|
| 810 |
# ูู HLS ูุณุชุญูู ุงูููุงุณ ุฅูุง ุนูู FFmpeg (ูู ู
ู ููุชุญ ุงููุงุฆู
ุฉ)ุ ูููุจู ุชูุฏูู
ู.
|
| 811 |
_fresh = (sess['ff_last'] if response is None else sess['last'])
|
| 812 |
-
|
|
|
|
|
|
|
|
|
|
| 813 |
attached = self._try_reattach(user, p, bridge, sess, stop, refresh,
|
| 814 |
read_timeout, retries, response, pump)
|
| 815 |
if attached:
|
|
|
|
| 576 |
return None
|
| 577 |
sess['swapping'] = True
|
| 578 |
sess['swap_source'] = True
|
| 579 |
+
sess['swap_started'] = time.monotonic()
|
| 580 |
try:
|
| 581 |
if response:
|
| 582 |
try:
|
|
|
|
| 607 |
sess['stall_reason'] = ''
|
| 608 |
sess['force_stop'] = False
|
| 609 |
sess['timeouts'] = 0
|
| 610 |
+
# Do not bump sess['last'] here: that hid 40โ57s of silence from the
|
| 611 |
+
# 12s stall watchdog (measured @vimtoo.2: out frozen, age 42โ57, yh still good).
|
| 612 |
sess['reattaches'] = int(sess.get('reattaches') or 0) + 1
|
| 613 |
self.current_candidate = cand
|
| 614 |
self.set(source=cand.get('label') or cand.get('brief') or '', stalled=False)
|
|
|
|
| 811 |
# ุญููุง ูููุชููุจ ูุจูู ุนูู ุขุฎุฑ ุซุงููุฉ โ ููุฐุง ูู ุงูุชุนููู ุงูุฐู ุดูุง ู
ูู ุงูู
ุณุชุฎุฏู
.
|
| 812 |
# ูู HLS ูุณุชุญูู ุงูููุงุณ ุฅูุง ุนูู FFmpeg (ูู ู
ู ููุชุญ ุงููุงุฆู
ุฉ)ุ ูููุจู ุชูุฏูู
ู.
|
| 813 |
_fresh = (sess['ff_last'] if response is None else sess['last'])
|
| 814 |
+
swap_for = (now - float(sess.get('swap_started') or 0)) if sess.get('swapping') else 0.0
|
| 815 |
+
# swapping must not disable the stall watchdog for longer than the stall
|
| 816 |
+
# limit: refresh()+HTTP open was measured at 40โ57s of frozen viewers.
|
| 817 |
+
if stall_limit and now - _fresh > stall_limit and (not sess.get('swapping') or swap_for > stall_limit):
|
| 818 |
attached = self._try_reattach(user, p, bridge, sess, stop, refresh,
|
| 819 |
read_timeout, retries, response, pump)
|
| 820 |
if attached:
|