Windowed module protocol: every op admitted inside a 3.4s window after the firmware's observed temp poll (cadence 3.5-4.2s measured, stuck-at-last-fetch stale mechanism proven and avoided), acquire/window with panic on dead heartbeat; noise column shows green on/off cycle phase, cable-missing state unchanged
This commit is contained in:
@@ -75,6 +75,8 @@ type noiser struct {
|
||||
// phase. Latched across the down phase, where the missing carrier is our
|
||||
// own doing and says nothing about the cable.
|
||||
connected atomic.Bool
|
||||
// The cycle's up phase: ports admin-up and the wire loud, training or frames.
|
||||
radiating atomic.Bool
|
||||
}
|
||||
|
||||
func newNoiser() (*noiser, error) {
|
||||
@@ -113,14 +115,20 @@ func (n *noiser) names() []string {
|
||||
return []string{n.eps[0].name, n.eps[1].name}
|
||||
}
|
||||
|
||||
// Zero while the cable was there at the last verdict, one while it was not:
|
||||
// the shape the error cells already colour by, so absence paints as the fault
|
||||
// it is and presence as the usual green.
|
||||
func (n *noiser) missing() uint64 {
|
||||
if n.connected.Load() {
|
||||
return 0
|
||||
type noiseView struct {
|
||||
missing uint64
|
||||
on bool
|
||||
}
|
||||
|
||||
// missing is zero while the cable was there at the last verdict, one while it
|
||||
// was not: the shape the error cells already colour by, so absence paints as
|
||||
// the fault it is. on is the cycle's phase, presence granted.
|
||||
func (n *noiser) view() noiseView {
|
||||
v := noiseView{on: n.radiating.Load()}
|
||||
if !n.connected.Load() {
|
||||
v.missing = 1
|
||||
}
|
||||
return 1
|
||||
return v
|
||||
}
|
||||
|
||||
// The ports were reachable when the noiser was built, so one that stops taking
|
||||
@@ -173,6 +181,7 @@ func (n *noiser) run(done *atomic.Bool) {
|
||||
|
||||
for !done.Load() {
|
||||
n.setLinks(fd, true)
|
||||
n.radiating.Store(true)
|
||||
linked := false
|
||||
for end := time.Now().Add(noiseUpSpan); time.Now().Before(end) && !done.Load(); {
|
||||
<-tick.C
|
||||
@@ -190,6 +199,7 @@ func (n *noiser) run(done *atomic.Bool) {
|
||||
n.connected.Store(linked)
|
||||
|
||||
n.setLinks(fd, false)
|
||||
n.radiating.Store(false)
|
||||
for end := time.Now().Add(noiseDownSpan); time.Now().Before(end) && !done.Load(); {
|
||||
<-tick.C
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user