()
| 427 | } |
| 428 | |
| 429 | func (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 | |
| 449 | func (router *WshRouter) drainLinkBacklog_withLock(linkId baseds.LinkId, lm *linkMeta, backlog []backlogMessageWrap) []backlogMessageWrap { |
| 450 | for len(backlog) > 0 { |
no test coverage detected