Problem
Remoter.refresh() currently calls Tymer.restart(). restart() advances from the previous deadline, which preserves periodic cadence but does not reset an inactivity timeout.
Successful Remoter reads and writes call refresh(). Each call therefore adds another timeout duration to the previous deadline instead of setting it to current tyme + tymeout. This can grant an active connection increasing amounts of future idle time and delay stale-connection cleanup.
Reproduction
def test_remoter_refresh_resets_idle_tymeout_from_current_tyme():
tymist = tyming.Tymist()
remoter = tcp.Remoter(
tymth=tymist.tymen(),
ha=("127.0.0.1", 56000),
ca=("127.0.0.1", 56001),
cs=None,
tymeout=1.0,
)
tymist.tick(tock=0.75)
remoter.refresh()
remoter.refresh()
assert remoter.tymer.remaining == pytest.approx(1.0)
Run:
pytest -q tests/core/tcp/test_tcp.py::test_remoter_refresh_resets_idle_tymeout_from_current_tyme
Current result:
Obtained: 2.25
Expected: 1.0
A single refresh is already incorrect: at tyme == 0.75, it leaves 1.25 seconds remaining instead of resetting the remaining idle timeout to 1.0. Repeated refreshes accumulate the error.
Expected behavior
Refreshing an idle timeout should set its deadline relative to the current scheduler tyme. For a Remoter without an injected tyme base, refreshing should remain a no-op because no inactivity interval can be measured.
Related pull requests
Problem
Remoter.refresh()currently callsTymer.restart().restart()advances from the previous deadline, which preserves periodic cadence but does not reset an inactivity timeout.Successful
Remoterreads and writes callrefresh(). Each call therefore adds another timeout duration to the previous deadline instead of setting it tocurrent tyme + tymeout. This can grant an active connection increasing amounts of future idle time and delay stale-connection cleanup.Reproduction
Run:
Current result:
A single refresh is already incorrect: at
tyme == 0.75, it leaves1.25seconds remaining instead of resetting the remaining idle timeout to1.0. Repeated refreshes accumulate the error.Expected behavior
Refreshing an idle timeout should set its deadline relative to the current scheduler tyme. For a
Remoterwithout an injected tyme base, refreshing should remain a no-op because no inactivity interval can be measured.Related pull requests
release/v0.6.20backport: backport: reset Remoter idle timeout from current tyme GLEIF-IT/hio#7