v0.2.0 80c61e3

output_pacer.go RawHistoryFolder

1package dgram
2
3import "github.com/bnema/vev/internal/ports"
4
5type dataSendJob struct {
6	seq      uint64
7	reliable bool
8	frame    ports.Frame
9	done     chan error
10}
11
12type queuedSend = dataSendJob
13
14func (t *Transport) outputPaceLoop() {
15	for {
16		t.outboundMu.Lock()
17		t.mu.Lock()
18		if len(t.outputQueue) == 0 && !t.closed {
19			wake := t.outputWake
20			t.mu.Unlock()
21			t.outboundMu.Unlock()
22			select {
23			case <-wake:
24			case <-t.done:
25				return
26			}
27			continue
28		}
29		if t.closed {
30			t.mu.Unlock()
31			t.outboundMu.Unlock()
32			return
33		}
34		q := t.outputQueue[0]
35		copy(t.outputQueue, t.outputQueue[1:])
36		t.outputQueue = t.outputQueue[:len(t.outputQueue)-1]
37		t.mu.Unlock()
38		if err := t.queueDataJob(q); err != nil {
39			t.removeQueuedPending([]queuedSend{q}, err)
40			t.outboundMu.Unlock()
41			return
42		}
43		t.outboundMu.Unlock()
44	}
45}
46
47func (t *Transport) notifyOutputPacerLocked() {
48	if t.outputWake == nil {
49		return
50	}
51	close(t.outputWake)
52	t.outputWake = make(chan struct{})
53}
54
55func shouldPaceOutput(f ports.Frame) bool {
56	return f.Type == ports.MsgOutput
57}
58
59func (t *Transport) markPendingSent(seq uint64, reliable bool) {
60	if !reliable {
61		return
62	}
63	t.mu.Lock()
64	if p := t.pending[seq]; p != nil {
65		p.initialInFlight = true
66	}
67	t.mu.Unlock()
68}
69
70func (t *Transport) markPendingReady(seq uint64, reliable bool) {
71	if !reliable {
72		return
73	}
74	t.mu.Lock()
75	if p := t.pending[seq]; p != nil {
76		p.initialInFlight = false
77	}
78	t.mu.Unlock()
79}
80
81func (t *Transport) markPendingFinalWrite(seq uint64) {
82	now := t.clock.Now()
83	t.mu.Lock()
84	if p := t.pending[seq]; p != nil {
85		if p.first.IsZero() {
86			p.first = now
87		}
88		p.last = now
89	}
90	t.mu.Unlock()
91}

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