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

Method runUpstreamBufferLoop

pkg/wshutil/wshrouter.go:429–447  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

427}
428
429func (router *WshRouter) runUpstreamBufferLoop() {
430 defer func() {
431 panichandler.PanicHandler("WshRouter:runUpstreamBufferLoop", recover())
432 }()
433 for {
434 router.upstreamBufLock.Lock()
435 for len(router.upstreamBuf) == 0 {
436 router.upstreamBufCond.Wait()
437 }
438 msg := router.upstreamBuf[0]
439 router.upstreamBuf = router.upstreamBuf[1:]
440 router.upstreamBufLock.Unlock()
441
442 upstreamLinkId, upstream := router.getUpstreamClient()
443 if upstream != nil {
444 router.sendRpcMessageToLink(upstreamLinkId, upstream, msg.msgBytes, baseds.NoLinkId, msg.debugStr)
445 }
446 }
447}
448
449func (router *WshRouter) drainLinkBacklog_withLock(linkId baseds.LinkId, lm *linkMeta, backlog []backlogMessageWrap) []backlogMessageWrap {
450 for len(backlog) > 0 {

Callers 1

queueUpstreamMessageMethod · 0.95

Calls 4

getUpstreamClientMethod · 0.95
sendRpcMessageToLinkMethod · 0.95
PanicHandlerFunction · 0.92
WaitMethod · 0.65

Tested by

no test coverage detected