detached 8442b74

refactor(protocol): share the echo acknowledgement delay

The client's round-trip correction copied the daemon's 50 ms echo acknowledgement delay as a separate literal. Both now use protocol.EchoAckDelay.
commit
8442b743fe08c946e327593ebe8546e05d2525a3
author
brice · · 2026-10-08 06:01 UTC
parent
706193c
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +12 -9
M internal/protocol/session.go +6 -0
@@ -229,6 +229,12 @@ func (c ViewContext) Validate() error {
229229 return domain.ValidatePaneStableID(c.FocusedPaneID)
230230 }
231231
232+// EchoAckDelay is how long sequenced input must have been applied before the
233+// daemon acknowledges it in Output.Echo. Like mosh's ECHO_TIMEOUT, it gives the
234+// PTY time to echo the input, so the screen published with the acknowledgement
235+// already contains that echo. Clients remove it from round-trip samples.
236+const EchoAckDelay = 50 * time.Millisecond
237+
232238 type Output struct {
233239 Epoch uint64
234240 Base uint64
@@ -229,6 +229,12 @@ func (c ViewContext) Validate() error {
229 return domain.ValidatePaneStableID(c.FocusedPaneID)229 return domain.ValidatePaneStableID(c.FocusedPaneID)
230 }230 }
231 231
232+// EchoAckDelay is how long sequenced input must have been applied before the
233+// daemon acknowledges it in Output.Echo. Like mosh's ECHO_TIMEOUT, it gives the
234+// PTY time to echo the input, so the screen published with the acknowledgement
235+// already contains that echo. Clients remove it from round-trip samples.
236+const EchoAckDelay = 50 * time.Millisecond
237+
232 type Output struct {238 type Output struct {
233 Epoch uint64239 Epoch uint64
234 Base uint64240 Base uint64
M internal/usecase/client/predictive_echo.go +3 -4
@@ -47,10 +47,9 @@ const (
4747 echoGlitchRepairCount = 10
4848 echoGlitchRepairMinInterval = 150 * time.Millisecond
4949
50- // echoServerDelay is the daemon's echo acknowledgement delay
51- // (usecase/daemon echoAckDelay). It is removed from each round-trip
52- // sample so the thresholds compare network time, as mosh's SRTT does.
53- echoServerDelay = 50 * time.Millisecond
50+ // echoServerDelay is removed from each round-trip sample so the
51+ // thresholds compare network time, as mosh's SRTT does.
52+ echoServerDelay = protocol.EchoAckDelay
5453
5554 // maxEchoSent bounds the send-time history used for round-trip samples.
5655 maxEchoSent = 256
@@ -47,10 +47,9 @@ const (
47 echoGlitchRepairCount = 1047 echoGlitchRepairCount = 10
48 echoGlitchRepairMinInterval = 150 * time.Millisecond48 echoGlitchRepairMinInterval = 150 * time.Millisecond
49 49
50- // echoServerDelay is the daemon's echo acknowledgement delay50+ // echoServerDelay is removed from each round-trip sample so the
51- // (usecase/daemon echoAckDelay). It is removed from each round-trip51+ // thresholds compare network time, as mosh's SRTT does.
52- // sample so the thresholds compare network time, as mosh's SRTT does.52+ echoServerDelay = protocol.EchoAckDelay
53- echoServerDelay = 50 * time.Millisecond
54 53
55 // maxEchoSent bounds the send-time history used for round-trip samples.54 // maxEchoSent bounds the send-time history used for round-trip samples.
56 maxEchoSent = 25655 maxEchoSent = 256
M internal/usecase/daemon/echo_ack.go +3 -5
@@ -5,13 +5,11 @@ import (
55 "time"
66
77 "github.com/bnema/vev/internal/ports"
8+ "github.com/bnema/vev/internal/protocol"
89 )
910
10-// echoAckDelay is how long sequenced input must have been applied before the
11-// daemon acknowledges it in Output.Echo. Like mosh's ECHO_TIMEOUT, it gives the
12-// PTY time to echo the input, so the screen published with the acknowledgement
13-// already contains whatever echo the input produced.
14-const echoAckDelay = 50 * time.Millisecond
11+// echoAckDelay is the protocol's echo acknowledgement delay.
12+const echoAckDelay = protocol.EchoAckDelay
1513
1614 // maxPendingEchoes bounds the per-attachment input history. Acknowledgements
1715 // are cumulative, so dropping the oldest entry only delays its confirmation to
@@ -5,13 +5,11 @@ import (
5 "time"5 "time"
6 6
7 "github.com/bnema/vev/internal/ports"7 "github.com/bnema/vev/internal/ports"
8+ "github.com/bnema/vev/internal/protocol"
8 )9 )
9 10
10-// echoAckDelay is how long sequenced input must have been applied before the11+// echoAckDelay is the protocol's echo acknowledgement delay.
11-// daemon acknowledges it in Output.Echo. Like mosh's ECHO_TIMEOUT, it gives the12+const echoAckDelay = protocol.EchoAckDelay
12-// PTY time to echo the input, so the screen published with the acknowledgement
13-// already contains whatever echo the input produced.
14-const echoAckDelay = 50 * time.Millisecond
15 13
16 // maxPendingEchoes bounds the per-attachment input history. Acknowledgements14 // maxPendingEchoes bounds the per-attachment input history. Acknowledgements
17 // are cumulative, so dropping the oldest entry only delays its confirmation to15 // are cumulative, so dropping the oldest entry only delays its confirmation to

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close