MCPcopy
hub / github.com/hashicorp/memberlist / getNextMessage

Method getNextMessage

net.go:490–504  ·  view source on GitHub ↗

getNextMessage returns the next message to process in priority order, using LIFO

()

Source from the content-addressed store, hash-verified

488
489// getNextMessage returns the next message to process in priority order, using LIFO
490func (m *Memberlist) getNextMessage() (msgHandoff, bool) {
491 m.msgQueueLock.Lock()
492 defer m.msgQueueLock.Unlock()
493
494 if el := m.highPriorityMsgQueue.Back(); el != nil {
495 m.highPriorityMsgQueue.Remove(el)
496 msg := el.Value.(msgHandoff)
497 return msg, true
498 } else if el := m.lowPriorityMsgQueue.Back(); el != nil {
499 m.lowPriorityMsgQueue.Remove(el)
500 msg := el.Value.(msgHandoff)
501 return msg, true
502 }
503 return msgHandoff{}, false
504}
505
506// packetHandler is a long running goroutine that processes messages received
507// over the packet interface, but is decoupled from the listener to avoid

Callers 1

packetHandlerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected