MCPcopy Index your code
hub / github.com/google/seesaw / gratuitousARP

Method gratuitousARP

engine/core.go:333–362  ·  view source on GitHub ↗

gratuitousARP sends gratuitous ARP messages at regular intervals, if this node is the HA master.

()

Source from the content-addressed store, hash-verified

331// gratuitousARP sends gratuitous ARP messages at regular intervals, if this
332// node is the HA master.
333func (e *Engine) gratuitousARP() {
334 arpTicker := time.NewTicker(e.config.GratuitousARPInterval)
335 var announced bool
336 for {
337 select {
338 case <-arpTicker.C:
339 if e.haManager.state() != spb.HaState_LEADER {
340 if announced {
341 log.Info("Stopping gratuitous ARPs")
342 announced = false
343 }
344 continue
345 }
346 if !announced {
347 log.Infof("Starting gratuitous ARPs every %s", e.config.GratuitousARPInterval)
348 announced = true
349 }
350 e.arpLock.Lock()
351 arpMap := e.arpMap
352 e.arpLock.Unlock()
353 if err := e.ncc.ARPSendGratuitous(arpMap); err != nil {
354 log.Fatalf("Failed to send gratuitous ARP: %v", err)
355 }
356
357 case <-e.shutdownARP:
358 e.shutdownARP <- true
359 return
360 }
361 }
362}
363
364// manager is responsible for managing and co-ordinating various parts of the
365// seesaw engine.

Callers 1

RunMethod · 0.95

Implementers 3

EngineClientha/engine_client.go
DummyEngineha/engine_client.go
SeesawEngineengine/ipc.go

Calls 2

ARPSendGratuitousMethod · 0.65
stateMethod · 0.45

Tested by

no test coverage detected