ax(node): rename stopChan to stopChannel in PeerRegistry

'Chan' is an abbreviation; AX Principle 1 requires predictable names
over short names. stopChannel is unambiguous without a comment.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 14:16:07 +01:00
parent 5b7c84142e
commit 9280527f19
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -109,8 +109,8 @@ type PeerRegistry struct {
dirty bool // Whether there are unsaved changes
saveTimer *time.Timer // Timer for debounced save
saveMutex sync.Mutex // Protects dirty and saveTimer
stopChan chan struct{} // Signal to stop background save
saveStopOnce sync.Once // Ensure stopChan is closed only once
stopChannel chan struct{} // Signal to stop background save
saveStopOnce sync.Once // Ensure stopChannel is closed only once
}
// Dimension weights for peer selection.
@ -139,7 +139,7 @@ func NewPeerRegistryWithPath(peersPath string) (*PeerRegistry, error) {
registry := &PeerRegistry{
peers: make(map[string]*Peer),
peersFilePath: peersPath,
stopChan: make(chan struct{}),
stopChannel: make(chan struct{}),
authMode: PeerAuthOpen, // Default to open for backward compatibility
allowedPublicKeys: make(map[string]bool),
}
@ -662,7 +662,7 @@ func (registry *PeerRegistry) saveNow() error {
// defer registry.Close() // flush pending writes on shutdown
func (registry *PeerRegistry) Close() error {
registry.saveStopOnce.Do(func() {
close(registry.stopChan)
close(registry.stopChannel)
})
// Cancel pending timer and save immediately if dirty