MCPcopy
hub / github.com/wavetermdev/waveterm / queueUpstreamMessage

Method queueUpstreamMessage

pkg/wshutil/wshrouter.go:414–427  ·  view source on GitHub ↗

this will never block, can be called while holding router.Lock

(msgBytes []byte, debugStr string)

Source from the content-addressed store, hash-verified

412
413// this will never block, can be called while holding router.Lock
414func (router *WshRouter) queueUpstreamMessage(msgBytes []byte, debugStr string) {
415 _, upstream := router.getUpstreamClient()
416 if upstream == nil {
417 return
418 }
419 router.upstreamBufLock.Lock()
420 defer router.upstreamBufLock.Unlock()
421 router.upstreamBuf = append(router.upstreamBuf, messageWrap{msgBytes: msgBytes, debugStr: debugStr})
422 if !router.upstreamLoopStarted {
423 router.upstreamLoopStarted = true
424 go router.runUpstreamBufferLoop()
425 }
426 router.upstreamBufCond.Signal()
427}
428
429func (router *WshRouter) runUpstreamBufferLoop() {
430 defer func() {

Callers 2

announceUpstreamMethod · 0.95
unannounceUpstreamMethod · 0.95

Calls 2

getUpstreamClientMethod · 0.95
runUpstreamBufferLoopMethod · 0.95

Tested by

no test coverage detected