MCPcopy
hub / github.com/nats-io/nats.go / removeFlushEntry

Method removeFlushEntry

nats.go:5748–5761  ·  view source on GitHub ↗

FIXME: This is a hack removeFlushEntry is needed when we need to discard queued up responses for our pings as part of a flush call. This happens when we have a flush call outstanding and we call close.

(ch chan struct{})

Source from the content-addressed store, hash-verified

5746// for our pings as part of a flush call. This happens when we have a flush
5747// call outstanding and we call close.
5748func (nc *Conn) removeFlushEntry(ch chan struct{}) bool {
5749 nc.mu.Lock()
5750 defer nc.mu.Unlock()
5751 if nc.pongs == nil {
5752 return false
5753 }
5754 for i, c := range nc.pongs {
5755 if c == ch {
5756 nc.pongs[i] = nil
5757 return true
5758 }
5759 }
5760 return false
5761}
5762
5763// The lock must be held entering this function.
5764func (nc *Conn) sendPing(ch chan struct{}) {

Callers 2

FlushTimeoutMethod · 0.95
FlushWithContextMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected