MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / publishToSubscribers

Method publishToSubscribers

internal/redisqueue/queue.go:141–160  ·  view source on GitHub ↗
(payload []byte)

Source from the content-addressed store, hash-verified

139}
140
141func (q *queue) publishToSubscribers(payload []byte) bool {
142 q.mu.Lock()
143 defer q.mu.Unlock()
144
145 if len(q.subscribers) == 0 {
146 return false
147 }
148
149 for id, subscriber := range q.subscribers {
150 cloned := append([]byte(nil), payload...)
151 select {
152 case subscriber <- cloned:
153 default:
154 delete(q.subscribers, id)
155 close(subscriber)
156 }
157 }
158
159 return true
160}
161
162func (q *queue) subscribe(buffer int, initialPayload []byte) (<-chan []byte, func()) {
163 subscriber := make(chan []byte, buffer)

Callers 3

EnqueueFunction · 0.80
EnqueueErrorFunction · 0.80
NotifyUsageRefreshFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected